• Can you extend the plugin with a filter? So one can specify a custom validator for specific emails to be skipped. Example given we have a shop where Bol.com orders are processed, but we do not want the @verkopen.bol.com addresses in MailChimp, similar like the solution already in the plugin for Amazon addresses. But in general a filter for this should be most convenient.

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

    (@ryanhungate)

    @peppol yes we can do that in a future release, it’s a good idea. For now, if you need help patching something right this second, I do have a solution for you.

    2 locations need to be touched:

    1. class-mailchimp-woocommerce-single-order.php

    
        /**
         * @param $email
         * @param $order_id
         * @return bool
         */
        protected function shouldSkipOrder($email, $order_id)
        {
            // basically do whatever you need to do to decide the logic.
            //if (execute_your_custom_filter($email)) return true;
    
            if (!is_email($email)) {
                mailchimp_log('validation.bad_email', "Order #{$order_id} has an invalid email address. Skipping!");
                return true;
            }
    
            // make sure we can submit this order to MailChimp or skip it.
            if (mailchimp_email_is_amazon($email)) {
                mailchimp_log('validation.amazon', "Order #{$order_id} was placed through Amazon. Skipping!");
                return true;
            }
    
            if (mailchimp_email_is_privacy_protected($email)) {
                mailchimp_log('validation.gdpr', "Order #{$order_id} is GDPR restricted. Skipping!");
                return true;
            }
    
            return false;
        }
    

    And also in the bootstrap.php file

    
    /**
     * @param $email
     * @return bool
     */
    function mailchimp_email_is_allowed($email) {
        // basically do whatever you need to do to decide the logic.
        //if (execute_your_custom_filter($email)) return false;
    
        if (!is_email($email) || mailchimp_email_is_amazon($email) || mailchimp_email_is_privacy_protected($email)) {
            return false;
        }
        return true;
    }
    

    We will think this through in our next release to add a custom filter for both skipping the list members and also the orders for you and report back. Again thanks for the idea. 🙂

Viewing 1 replies (of 1 total)

The topic ‘Add filter for custom allowed email validation’ is closed to new replies.