Hey guys
Please does anyone know how to limit number products allowed to add in woocommerce. I mean internally I wanna limit amount of products can be added to the woocommerce. Regards,
Hey guys
Please does anyone know how to limit number products allowed to add in woocommerce. I mean internally I wanna limit amount of products can be added to the woocommerce. Regards,
Hey,
use that code, paste it in functions.php
add_action( 'admin_head-post-new.php', 'woo_limit_products_creation' ); function woo_limit_products_creation() { global $post_type; global $wpdb; $products_limit = 50; // Change this value if( $post_type === 'product' ) { $products_count = $wpdb->get_var( "SELECT count(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'product'" ); if( $products_count >= $products_limit ) { wp_die( sprintf( __("Error. You are not allowed to create more than %s products."), $products_limit) ); } } return; }
Hello corsonr,
How to limit the amount of products by administrator users?
Each administrator can register for an X amount of products.