Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mailchimp unset a merge var via api

Tags:

php

mailchimp

I have a working sync between my local DB and mail chimp. In most cases it works fine. However there is one case that doesn't seem to work.

I am updating subscribers using the Subscribe method. With both update_existing and replace_interests set to true.

I can set merge vars via this method. However I don't seem to be able to unset them.

I have tried

  • Not putting item in the array at all.
  • Passing an empty string in the merge vars array for the value.
  • Passing flase as the value.
  • Passing null as the value.

None of which seem to affect the value at all.

like image 522
Jeremy French Avatar asked Nov 10 '22 20:11

Jeremy French


1 Answers

Although this question is quite dated, I've found that passing an empty string does in fact unset a merge field.

Using the Mailchimp API to edit a list member via PUT or PATCH:

{ 'FNAME': 'John', 'LNAME: '' }

The above will unset any previously set LNAME.

like image 177
Julian Laval Avatar answered Nov 14 '22 22:11

Julian Laval