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.
Thank you For sharing the Great article and this article is very helpful for me.
we follow this technique in my activities to improve.keep it up my friend.
Aura Home Remodeling & Construction expertise in custom home additions and room additions. We employ only the most professional team of contractors who are able to handle any type of custom home additions and room additions. With years of experience we have all the skills and knowledge take care of any type of addition, whether it is a game room, sun room or a second floor addition – we do it all. We work with the best professionals and with high quality and most updated tools and equipment. We make sure the results you will get are durable, beautiful and fits exactly or even more to you expectations.
Thank you, helpful tip! What would be the snippet to remove the qty field from shop/archive pages as well? I found that this field is not working well on mobile devices.
Thank you for this solution.