Make Woocommerce Products Sold Individually By Default

So one of my new personal websites sells virtual products where customers buy just one product at a time. I don’t need quantities and nor do I want quantity boxes on the product page or the checkout, there just no need for it. So there could be a way to bring in some jQuery into the WordPress admin to force the check box on the product edit page but a neater solution is to actually just drop this into the functions.php file or seperate plugin file to achieve the same thing:

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

Now, when you create a new product, you will notice the checkbox is NOT checked, however if you publish the product with it unchecked, there will be no quantity allocated to the product.

Useful post? Share it

Leave a Reply

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