• Resolved jurasjo

    (@jurasjo)


    Hi
    I would like to add coupon when 2 products are added to the cart. I have created coupon and set it like shown on the screen below.
    Screenshot1

    Works ok.

    When first product is added, coupon is not applied – expected behavior but there is this red color warning above the cart:
    Sorry, it seems the coupon "2kursy" is invalid - it has now been removed from your order.
    Screenshot2

    Of course after adding second product to the cart message disappears but I would like to get rid of that message also in the first place.

    Also after removing one of the products from the cart there is this message displayed.
    Sorry, it seems the coupon "2kursy" is invalid - it has now been removed from your order.
    Screenshot2

    • This topic was modified 7 years, 9 months ago by jurasjo.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Soft79

    (@josk79)

    Strange,

    can you send me an url so I can reproduce?

    Thread Starter jurasjo

    (@jurasjo)

    Hi

    It is my test site My site

    Here is also Miscellaneous tab.
    Screenshot3

    • This reply was modified 7 years, 9 months ago by jurasjo.
    • This reply was modified 7 years, 9 months ago by jurasjo.
    Plugin Author Soft79

    (@josk79)

    Can you please try with a standard theme and plugins disabled?

    Thread Starter jurasjo

    (@jurasjo)

    Hi again.

    On the Twenty Seventeen theme there is no warning messages.

    I use my own theme based on Bootstrap. I have never had any problems because of that.

    I hope there is some workaround for this.

    Plugin Author Soft79

    (@josk79)

    Maybe a conflicting script in functions.php or different order of actions.

    Thread Starter jurasjo

    (@jurasjo)

    BINGO!

    I have used function:

    // Hide coupon notice on the checkout page if a coupon has been applied in cart
    		function woocommerce_coupons_enabled_checkout( $coupons_enabled ) {
    			global $woocommerce;
    	    	if ( ! empty( $woocommerce->cart->applied_coupons ) ) {
    	        return false;
    	    }
    	    return $coupons_enabled;
    	}
    	add_filter( 'woocommerce_coupons_enabled', 'woocommerce_coupons_enabled_checkout' );

    After removing it, everything works normal.

    Big THX.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘2 products in the cart’ is closed to new replies.