Do you have a WooCommerce store and would you like to include more customer fields in your Mailchimp list? By default the Mailchimp for WordPress plugin sends over only the NAME, FNAME, LNAME and EMAIL fields. If you would like to add some more, a little editing is required.

Manually send more WooCommerce fields to your list

To send more fields to Mailchimp, you will have to tell the Mailchimp for WordPress plugin which field values to grab and in which Mailchimp field the data should be stored.

For example, let’s send some text to the “COUNTRY” and “CITY” field in Mailchimp. To do this, add the following to your functions.php file:

add_filter('mc4wp_integration_woocommerce_data', function($data, $order_id) {
	$order = wc_get_order( $order_id );
	$data['COUNTRY'] = $order->get_billing_country();
	$data['CITY'] = $order->get_billing_city();
	return $data;
}, 10, 2 );

With this code, you’re adding the WooCommerce fields called billing_country and billing_city to your Mailchimp fields called COUNTRY and CITY respectively.

You can send as many or as little fields as you want. Just make sure the fields you’re sending over also exist in your Mailchimp list!

If you’re adding new fields to your Mailchimp list, don’t forget to renew your list afterwards.

A more advanced example for address fields

Let’s say you have a field named “ADDR” in your Mailchimp account which is of the “address” type. To send the WooCommerce checkout billing address to this field, you can use the following code.

add_filter('mc4wp_integration_woocommerce_data', function($data, $order_id) {
	$order = wc_get_order($order_id);
	$data['ADDR'] = array(
		'addr1' => $order->get_billing_address_1(),
		'city' => $order->get_billing_city(),
		'country' => $order->get_billing_country(),
		'zip' => $order->get_billing_postcode(),
		'state' => $order->get_billing_state(),
	);
	return $data;
}, 10, 2 );

You can find a full list of the WooCommerce checkout fields here.