By default, WooCommerce shows a quantity selector on a product’s page. This might not always be needed, so here are the ways in which you disable this feature.
Method 1: Using the option in the Product Data metabox
This meta box is found on the wp-admin page for editing that particular product. Scroll down past the editor and you will find the Product Data metabox and the setting under Inventory.
Method 2: Using a hook or filter
1
2
|
function custom_remove_all_quantity_fields( $return, $product ) {return true;}
add_filter( 'woocommerce_is_sold_individually','custom_remove_all_quantity_fields', 10, 2 );
|
You can insert this piece of code into your theme’s functions.php file, or in a custom plugin if you wish.
Hope you find that helpful.
0 comments:
Post a Comment