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

10 comments on “Make Woocommerce Products Sold Individually By Default

  1. Exactly what I needed! (but for the opposite reason). For some reason products were defaulting to sold individually = true even when set to false in the admin. This fixed it!

    1. Hi, this snippet doesn’t remove duplicate products, it enables products to be sold once only per customer. So they can only have one of that product at any time. Hope that helps.

Leave a Reply

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