Support » Plugin: Mailchimp for WooCommerce » Capturing Email on Cart Page

  • Resolved karam125

    (@karam125)


    Hello,

    I’d like to add an Email field to my cart page, so MailChimp will trigger it whenever the cart is abandoned.

    Right now it triggers only when the purchase fails since the email field is on the Checkout page.

    How can I add this field to the cart page?

    Thanks,

Viewing 1 replies (of 1 total)
  • Plugin Author ryanhungate

    (@ryanhungate)

    @karam125 that is where the “cart abandonment” is considered a true abandonment. If they’re shopping around but never make it to the checkout page, that wasn’t really considered yet to the plugin as an abandon event.

    We could however allow you to do something like this on another screen and tap into our “capture the email” function. The thought would be you could add this anywhere in your store, to “listen” for the current shopper’s email address and then use our native function to start tracking the cart to Mailchimp.

    That’s not really something we’ve considered yet in the plugin but there’s ways to connect as I just said – here’s an example of some javascript code that it would take to implement this. Keep in mind you would want to be putting this in a document ready function, and is not production ready. You’ll need to extract the logic here and use it where you see fit.

    
    let custom_email_selector = document.querySelector("#your_custom_selector");
    
    if (custom_email_selector) {
        custom_email_selector.onblur = function () { 
            mailchimpHandleBillingEmail('#your_custom_selector'); 
        };
        custom_email_selector.onfocus = function () { 
            mailchimpHandleBillingEmail('#your_custom_selector'); 
        }
    }
    
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.