如何在Mailchimp列表

时间:2018-02-21 11:29:23

标签: jquery shopify mailchimp

我有Mailchimp应用程序并设置集成,一切似乎都有效,除了它没有输出客户的全名。我可以输出名字和姓氏,但连接输出为0.

if($verified) {

  $customer_data = json_decode($data);
  $customer_email = $customer_data->email;
  $customer_fname = $customer_data->first_name;
  $customer_lname = $customer_data->last_name;
  $customer_name = $customer_fname + " " + $customer_lname;

  mc_subscribe($customer_email, $customer_name, $m_apikey, '$listid', 'us7');

}

function mc_subscribe($email, $name, $apikey, $listid, $server) {
  $auth = base64_encode( 'user:'.$apikey );
  $data = array(
    'apikey'        => $apikey,
    'email_address' => $email,
    'status'        => 'subscribed',
    'merge_fields'  => array(
      'MMERGE5' => $name
    )
  );

1 个答案:

答案 0 :(得分:0)

PHP连接运算符是(。)而不是(+)所以试试这个:

$ customer_name = $ customer_fname。 " " $ customer_lname;