• Resolved alemarengo84

    (@alemarengo84)


    Hi!
    I’ll describe my case:
    I setup a coupon for a spcific customer, so I set a coupon to be only for a specific email address. To ease things for my customer, I thought it could be possible to use your great plugin to apply coupon automatically when my specific customer would have been logged in and on cart/checkout.
    Unfortunately, that specific coupon is visible to everyone. Tha’ts NOT good at all.
    How can I fix this?
    Could it be that I have one other woothemes plugin for coupons?
    Could you be so kind to make some test with/for me?

    Please, let me know.
    Thanks in advance.

    https://wordpress.org/plugins/woocommerce-auto-added-coupons/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Soft79

    (@josk79)

    Hi,

    yes, the email restriction is an exception, because most of the time the users’ email address is not yet known before checkout.

    I found a solution, though. Please try https://downloads.wordpress.org/plugin/woocommerce-auto-added-coupons.zip

    – If the user is logged in, it’s email address will be used to check the email restriction
    – When performing the checkout, the billing email address will be used to check the email restriction

    If you use ajax checkout, please paste this snippet in your themes 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;
    } );

    Let me know if this works for you, and I’ll release this fix in the next version of the plugin.

    Thread Starter alemarengo84

    (@alemarengo84)

    Hi josk79!
    Thanks for your reply.
    I followed your suggestions, this is what happened:
    – with no customer logged in, when customer email address has been put on email addr. field, existing coupon has been NOT added automatically; if I put code manually, ok, it works, but this is out of your interest, I think. So performing a guest checkout session, email address is not recognized.
    – when a customer is logged in, coupon has been applied automatically: that’s correct! 🙂
    – I do not know if I have an ajax checkout.. How could I? I think I have the standard woo checkout running.

    Thanks!

    Plugin Author Soft79

    (@josk79)

    I just checked puntobianco, and you do have ajax checkout enabled (if you change the Città, Il tuo ordine gets updated, this is done by ajax).

    Did you place the add_filter snippet? Your billing_email field doesn’t have the update_totals_on_change class. This is required for the Il tuo ordine to be updated after entering the email address.

    Try this:

    1st: checkout with all requisites for the discount (except email)
    2nd: fill in the email
    3rd: Change the city

    now, when Il tuo ordine gets updated, does it show the discount?

    Plugin Author Soft79

    (@josk79)

    You still have issues, or can I close this topic?

    Plugin Author Soft79

    (@josk79)

    Email filter functionality has been added to version 2.0.0 of this plugin. Please let me know if it works for you.

    Thread Starter alemarengo84

    (@alemarengo84)

    Hi josk, sorry for delay!
    To me, everything seemed to be ok with your latest release.
    Thanks! 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘coupon automatically applied also when restrictions are not met’ is closed to new replies.