Your merge fields were invalid.
-
I keep getting email notifications for every order stating “Your merge fields were invalid.” I have tried the following function:
// tie into the WooCommerce MailChimp 'ss_wc_mailchimp_subscribe_merge_vars' action filter to modify the MailChimp merge vars function ss_wc_modify_mailchimp_merge_fields( $merge_vars, $order_id ) { // By default $merge_vars will look like array( 'FNAME' => 'Joe', 'LNAME' => 'Smith', 'EMAIL' => '[email protected]' ); // Retrieve the WooCommerce order $order = new WC_Order( $order_id ); // Get the order billing address $billing_address = $order->get_address( 'billing' ); // Get the billing address state $state = $billing_address[ 'state' ]; // Get the billing address country $country = $billing_address[ 'country' ]; // let's add a new 'STATE' merge field - NOTE: You'll need to change this to the actual name // of your merge field in MailChimp $merge_vars[ 'STATE' ] = $state; $merge_vars[ 'COUNTRY' ] = $country; return $merge_vars; } add_filter( 'ss_wc_mailchimp_subscribe_merge_vars' , 'ss_wc_modify_mailchimp_merge_fields', 10 , 2 );
I need State and Country fields to save to mail chimp as they are required by my signup form. Any help is greatly appreciated. Thanks!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Your merge fields were invalid.’ is closed to new replies.