Title: Anyone? Decrease quantity in mini cart woocommerce?
Last modified: August 22, 2016

---

# Anyone? Decrease quantity in mini cart woocommerce?

 *  [MarcelV91](https://wordpress.org/support/users/marcelv91/)
 * (@marcelv91)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/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!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [MarcelV91](https://wordpress.org/support/users/marcelv91/)
 * (@marcelv91)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/anyone-decrease-quantity-in-mini-cart-woocommerce/#post-5255704)
 * –
 *  Thread Starter [MarcelV91](https://wordpress.org/support/users/marcelv91/)
 * (@marcelv91)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/anyone-decrease-quantity-in-mini-cart-woocommerce/#post-5255705)
 * UPDATE:
    So I got a few things working using AJAX post. Cannot post to a PHP 
   file directly, needed to add the page in WP and call that page with a custom 
   template, which does the request handling.
 * However, the cart does not get updated after the ajax post? So I have to do a
   refresh before I see any change.
 * Ideas?
 *  Thread Starter [MarcelV91](https://wordpress.org/support/users/marcelv91/)
 * (@marcelv91)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/anyone-decrease-quantity-in-mini-cart-woocommerce/#post-5255778)
 * Appearantly nobody knows how to do this, or nobody was willing to help.
 * However, for future persons looking for this check my post on:
    [](http://stackoverflow.com/questions/25680719/decrease-quantity-in-mini-cart-woocommerce/25709336#25709336)
 * for a working solution.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Anyone? Decrease quantity in mini cart woocommerce?’ is closed to new
replies.

## Tags

 * [add to cart](https://wordpress.org/support/topic-tag/add-to-cart/)

 * 3 replies
 * 1 participant
 * Last reply from: [MarcelV91](https://wordpress.org/support/users/marcelv91/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/anyone-decrease-quantity-in-mini-cart-woocommerce/#post-5255778)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
