Coupon not being calculated
-
Hi,
I’m using Discount Rules to apply discounts on Cart totals.
The cart is managed via REST API (am using a custom implementation of https://www.ads-software.com/plugins/cart-rest-api-for-woocommerce/)
Currently when the cart is updated (product added, quantity changed, product removed), the coupon is not applied until the next time a request for the cart occurs.
e.g.
1. Change quantity in cart (discount not applied)
2. Change quantity again in cart (discount is applied from previous change)
3. Remove an item (discount is applied from previous change)If you make a change and GET the cart again, the discount rule is reflected.
After any cart changes, the API run the same function that is used to GET a cart.
So my question is, what methods can I call to force your plugin to calculate the coupons before using WC()->cart->get_cart()?
I have tried
– FlycartWooDiscountRules->applyRulesBeforeMiniCart();
– FlycartWooDiscountRules->applyCartDiscountRules();
– WC()->cart->calculate_totals();Thanks
- The topic ‘Coupon not being calculated’ is closed to new replies.