Anyone? Decrease quantity in mini cart woocommerce?
-
Hi,
I have read like every single topic about woocommerce but cannot find out how to add a minus button which decreases the quantity of a cart item (with ajax preferably) in the Woocommerce MiniCart.I did manage to add a button which increases the quantity using the woocommerce shortcode and via several other code samples. However, I cannot find how to decrease the quantity anywhere.
There are multiple questions about this, none answered. Or I`m searhing in the wrong directory.
However, can someone give me a code example on how to decrease cart`s quantity for a product out of the box? I already tried a custom php file with these lines of code:
$cartKey = $_POST['cart_item_key']; $cartQty = $_POST['cart_item_qty']; global $woocommerce; echo $woocommerce->cart->set_quantity($cartKey,$cartQty);
But calling this via AJAX post gives me an error (internal server error). I also tried add to cart with negative quantity, did not work either.
What can I do? Thanks a lot I hope someone can help here!
- The topic ‘Anyone? Decrease quantity in mini cart woocommerce?’ is closed to new replies.