Subscriber tags not added to MailChimp via MC4WP Integration

Plugin Contributor
Lap

(@lapzor)

Hi,

I assume you’re using the custom integration method?
The form ID won’t be available via an action argument, but it will e available via $_POST[‘_hf_form_id’]

add_filter( 'mc4wp_integration_woocommerce_subscriber_data', function( MC4WP_MailChimp_Subscriber $subscriber ) {

if (isset($_POST['_hf_form_id']) && $_POST['_hf_form_id'] == 250328) {
        $subscriber->tags[] = 'Tag 1';
    } else if (isset($_POST['_hf_form_id']) && $_POST['_hf_form_id'] == 250329) {
        $subscriber->tags[] = 'Tag 2';
}

    return $subscriber;
});

Hope that helps. If you have any questions, please let me know!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer