Posted on

Manipulate Quantity After Add To Cart

By default in our product table quantity is 1 and when you add the product into the cart product quantity will back to 1. If you want to set product quantity 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 product to the cart, quantity will back to the minimum value.

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

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

add_filter("wpto_qty_return_quanity","__return_false");

Still no luck? We can help!

Submit a Request

Contact us and we’ll get back to you as soon as possible.