如何在 Mailchimp 列表中输出 Shopify 客户的全名

How to output the a Shopify customer's full name on a Mailchimp list

我有 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
    )
  );

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

$customer_name = $customer_fname。 " ".$customer_lname;