Docly

Manipulate Quantity After Add To Cart

Estimated reading: 1 minute 158 views

By default in our product table, quantity is 1, and when you add the product into the cart product quantity will be back to 1. If you want to set the product quantity to 0 instead of 1, you can easily do it by using a filter hook called wpto_qty_return_zero.

add_filter("wpto_qty_return_zero","__return_true");

Now suppose you are using one of the quantity control plugin. In that case, when you add a product to the cart, the quantity will back to the minimum value.

But you want that quantity to be the same increment value. For example, if your product's minimum quantity is 2, and you increase the value to 6, then add the product to the cart. Now you don't want that the quantity value set back to the minimum value 2. You want quantity value remains that increase value 6.

For that, we just need to use the 'wpto_qty_return_quanity' filter.

add_filter("wpto_qty_return_quanity","__return_false");
CONTENTS