• Resolved petesalerno

    (@petesalerno)


    When you are on the cart page you can enter a coupon code. The discount is calculated correctly.
    If you change product quantity, and click update cart, the totals are adjusted, but the discount is not.
    Is there a way force the recalculation of the discounts when the cart is updated?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @petesalerno!

    Are you using the built-in core coupon functionality or another third-party plugin to add the coupons?

    If core, please share some screenshots of how you have the coupon configured. You can use the free https://snipboard.io tool to send the screenshots.

    Furthermore, could you please elaborate a bit more on what your specific requirements are in terms of the coupon itself needing to update along with the cart? What are the conditions for this?

    Cheers!

    Thread Starter petesalerno

    (@petesalerno)

    The are standard coupons. https://snipboard.io/7li0pJ.jpg

    I do modify their application with this snippet to verify minimum quantity and adjust the discount based on product:

    add_action( 'woocommerce_applied_coupon', 'add_promotion_to_cart' );
    
       function add_promotion_to_cart( $coupon_code ) {  
    	global $woocommerce;
    	$minimumorder = 19;
    	if ($woocommerce->cart->cart_contents_count > $minimumorder){
     		
    	   if ($coupon_code == "together") { 
                    $woocommerce->cart->remove_coupon( $coupon_code );
                    $new_code1 = "together1";
                    $new_code2 = "together2";
                    $woocommerce->cart->add_discount( $new_code1 );
    		$woocommerce->cart->add_discount( $new_code2 );
                    wc_print_notice('Promo Code Applied');
                }		
    
                    wc_clear_notices();
           } else {
                    $woocommerce->cart->remove_coupon( $coupon_code );
     		wc_print_notice('Minimum quantity for Promo Code is 20 Checks');
                    wc_clear_notices();
          }
    }
    

    Hello,

    On my test site, I’ve created a coupon with the same settings – set fixed product discount as 0.3 and restricted to a particular product only. However, I could not reproduce the same issue – the discount amount is adjusted properly when changing product quantity at checkout.

    That said, the issue is likely caused by a conflict with your theme or with another plugin. To determine what’s causing the issue, please temporarily switch your theme back to Storefront and disable all plugins except for WooCommerce. If that resolves the issue, then re-enable plugins one-by-one until you find the one that’s causing the conflict.

    You can find a more detailed explanation on how to do a conflict test here: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Hi @petesalerno

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Thread Starter petesalerno

    (@petesalerno)

    Thanks @maykato, I never got the email that you posted to this. I will try to identify the conflict. I’ll post if I find anything.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘coupons do not recalculate when cart is updated’ is closed to new replies.