• Resolved worgdev

    (@worgdev)


    Instructions on Github suggests that we are able to add additional merge tags using mailchimp_sync_user_mergetags filter.

    This does not seem to work

    I have tried submitting both, dynamic and hard-coded values such as this:

    $mergeVars['MMERGE5'] = 'Demo';

    $mergeVars['EMOPTIN'] = 'Yes';

    Merge tags MMERGE5 and EMOPTIN exist on Mailchimp side but are ignored (not populated).

    Full Example:

    
    function addCustomMergeTags($mergeVars, $user)
    
    {
    
    $customer = new WC_Customer($user->ID);
    
    if ($customer) {
    
    ...
    
    $mergeVars['SALUTATION'] = 'MR';
    
    }
    
    return $mergeVars;
    
    }
    
    add_filter('mailchimp_sync_user_mergetags', 'addCustomMergeTags', 100, 2);

    Tried the above without the logic for the customer as well.

    Also ensured that the function returns array ( temporarily returned false and could see the following message in the log ).

    The filter for mailchimp_sync_user_mergetags needs to return an array, using the default setup instead.

    The above means that the filter was executed when expected.

    All other default fields ( name, surname and email ) are working as expected. The problem is when you need to map custom merge tags.

    Is this supported at all? Is there a way to check what is being sent to Mailchimp?

    • This topic was modified 1 year, 6 months ago by worgdev.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter worgdev

    (@worgdev)

    Made a little progress on finding out the issue.

    Below is what the log says:

    2023-05-03T10:34:21+00:00 DEBUG debug :: mailchimp_member_data_update :: Array
    (
    [user_email] => [email protected]
    [user_language] => en
    [caller] => cart
    [status_if_new] => transactional
    ) 2023-05-03T10:34:21+00:00 ERROR cart.member.sync.error :: Error code transactional
    2023-05-03T10:34:23+00:00 NOTICE action_scheduler.queue_job :: MailChimp_WooCommerce_User_Submit queued :: obj_id 21
    2023-05-03T10:34:23+00:00 DEBUG action_scheduler.reschedule_job :: MailChimp_WooCommerce_User_Submit re-queued :: obj_id 21
    2023-05-03T10:34:24+00:00 DEBUG action_scheduler.reschedule_job :: MailChimp_WooCommerce_User_Submit re-queued :: obj_id 21
    2023-05-03T10:34:24+00:00 DEBUG action_scheduler.reschedule_job :: MailChimp_WooCommerce_User_Submit re-queued :: obj_id 21
    2023-05-03T10:34:25+00:00 NOTICE action_scheduler.queue_job :: MailChimp_WooCommerce_Single_Order starts in 90 seconds :: obj_id 8130
    2023-05-03T10:34:25+00:00 NOTICE debug :: Order ID 8130 was pending and is now processing :: Array
    (
    [new_order] => 1
    [tracking] => Array
    (
    [campaign_id] =>
    [landing_site] => https://site-local.local/checkout/order-received/8129/?key=wc_order_xj4rVYof869aD&utm_nooverride=1
    ) ) 2023-05-03T10:34:29+00:00 ERROR member.sync :: [email protected] :: Error Code 0 :: Error code transactional on 2003 in …/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-api.php

    This is my concern in particular:

    2023-05-03T10:34:21+00:00 ERROR cart.member.sync.error :: Error code transactional

    What is this error and how to fix it?

    Plugin Support khungate

    (@khungate)

    Hi there,

    I appreciate the detailed explanation of the issue you’re facing. Here are a few suggestions that may help you troubleshoot and resolve the problem:

    1. Placement of Function: Please make sure the function is correctly placed within your code and is executing as intended. I understand you have checked this, but it might be worth revisiting to ensure everything is in order.
    2. Merge Tags in Mailchimp: The merge tag you’re trying to add via the hook must be created in Mailchimp. The tag name should match exactly as it appears in Mailchimp. So, if you’re using $mergeVars['EMOPTIN'], make sure the EMOPTIN tag is already established in Mailchimp.
    3. Plugin Version: The error ERROR cart.member.sync.error :: Error code transactional isn’t something that I’m familiar with from the plugin. Could you please confirm the version of the plugin you’re currently using? It’s crucial to ensure you’re using the latest version, as the issue you’re facing might have been addressed in a more recent update.

    I look forward to your response so we can continue to work on this issue together.

    Thread Starter worgdev

    (@worgdev)

    Hi

    Thanks for getting back to me.

    The version is 2.8.3?

    Since posting the support ticket, it was established that I had a theme conflict which basically skewed data sent to MailChimp.

    I can confirm that Github instructions do pass additional merge tags as expected.

    Marking this as resolved

    Thanks again

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Additional merge tags’ is closed to new replies.