How to Remove the WooCommerce Quantity Field


How to Remove the WooCommerce Quantity Field

In this post, I will show you 2 ways to remove the quantity field from a WooCommerce product page.
By default, WooCommerce shows a quantity field or selector on your product pages. While this is a good feature to have, it might not always be needed. Say you are offering clients WordPress support plans – you would want each client to purchase only one plan at a time.

Video Tutorial

Let’s see how it’s done.

1. Using the Option in the Product Data Metabox.

To remove the quantity option in WooCommerce, go to your WooCommerce product page in the WordPress dashboard. Scroll down past the editor and you will find the Product Data metabox.

ghfg

Go to Inventory and enable the checkbox near Sold individually. Doing so allows only one item to be bought in a single order.

Don’t forget to update and refres h your product page. The quantity field is now disabled!

Related post: How To Change WooCommerce Currency Symbol

2. Using a hook snippet code or Filter to Remove the Quantity Field.

Alternatively, you can insert this piece of code into your theme’s functions.php file, or in a custom plugin called “Code Snippet” if you wish. This will remove the quantity field for all your WooCommerce products.

function custom_remove_all_quantity_fields( $return, $product ) {return true;}
add_filter( 'woocommerce_is_sold_individually','custom_remove_all_quantity_fields', 10, 2 );

Don’t forget to update and refresh your product page. The quantity field is now disabled!

Congratulations on remove quantity field from woocommerce product page.

Leave a Reply

Your email address will not be published. Required fields are marked *