Repository Forums Support WooCommerce Extended Coupon Features PRO Auto Coupon with Email Address Restriction

Topic Resolution: Resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2704
    iammike
    Participant

    Hi,

    I’m trying to setup a coupon, using your plugin, with the following conditions:

    1. Usage Restriction > Email restriction > allow only certain email addresses to redeem coupon (i.e. joe@tester.com)

    2. Miscellaneous > Auto Coupon – auto-apply coupon

    I have the coupon setup with an email address in the Email Restriction field, and have Auto Coupon enabled.

    However, at Checkout, when I enter the valid email address in the email address field (Billing Details section), the coupon is not auto-applied.

    I know the coupon is working, because I can manually apply the coupon code when the correct email is in the email address field. If the wrong email is in the field, the coupon will not apply as expected.

    Based on what I can tell, it seems like the Auto Coupon does not auto-refresh the totals after the email address field is filled out.

    Any help would be appreciated. Thanks!

    #2705
    Soft79
    Keymaster

    By default WooCommerce doesn’t refresh the cart when changing the billing email address. If you have a coupon that is restricted by email address, you could paste this snippet in your theme’s functions.php:

    //Update the cart preview when the billing email is changed by the customer
    add_filter( 'woocommerce_checkout_fields', function( $checkout_fields ) {
    $checkout_fields['billing']['billing_email']['class'][] = 'update_totals_on_change';
    return $checkout_fields;
    } );
    #2707
    iammike
    Participant

    Hi @soft79,

    Thanks so much for that info!

    We’ll do a test in functions.php, and see if that works.

    If so, we’ll activate our child theme, and put the custom code in there.

    Thanks again!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.