I am trying to send the custom field to mailchimp but not sure how to do this.
If you see below, I am trying to send company information to one of my Audiences but it's not sending through.
Here is the pasted code as well:
// member information
$json = json_encode([
'email_address' => $user_row['email'],
'status' => 'subscribed',
'COMPANY' => $company_info['name'],
'merge_fields' => [
'FNAME' => $user_row['first_name'],
'LNAME' => $user_row['last_name']
]
]);
I have created the custom field inside the mailchimp under targeted audiences. As you can see here:
So anyone can please help me that what I am doing wrong that company information is not syncing.
On Audiences I am receiving blank company name.
'COMPANY' => $company_info['name'],
The above line should be inside the 'merge_fields' like this
$json = json_encode([
'email_address' => $user_row['email'],
'status' => 'subscribed',
'merge_fields' => [
'FNAME' => $user_row['first_name'],
'LNAME' => $user_row['last_name'],
'COMPANY' => $company_info['name']
]
]);