Support » Plugin: WooCommerce » Update whole cart after adding/removing coupon

  • Hello,

    we’re using the dynamic pricing plugin to add a cart discount for orders with a specific total.
    We customized it to disable the discounts if a coupon is applied:

    add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
    function is_product_eligible( $eligible, $product, $discounter_name, $discounter_object ) {
    	global $woocommerce;
        remove_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
        if ( count($woocommerce->cart->applied_coupons) ) {
            $eligible = false;
        }
        
        add_filter( 'woocommerce_dynamic_pricing_process_product_discounts', 'is_product_eligible', 10, 4 );
    
        return $eligible;
    }

    Our problem is now that the cart ajax only seems to reload the cart total if a coupon is applied or removed and not the whole cart (with all items and prices per item). So even if the total is calculated correctly (with or without the discount) the cart still shows the discount on each product if a coupon is added and the other way around.

    So my question is now: Is there a possibility to force the whole cart to get updated after a coupon is applied/removed?

Viewing 1 replies (of 1 total)
  • Having this same issue – the coupon is not removed until the screen is refreshed.

    Did you find a solution to this geschan?

Viewing 1 replies (of 1 total)
  • The topic ‘Update whole cart after adding/removing coupon’ is closed to new replies.