• Resolved Webfolio Webdesign

    (@webreneszansz)


    Hi,

    We would like to use this plugin to create specific segment from the customers of the Woo shop.

    I mean, we need to add specific tag to the already MC subscribed Woo shop customers in case of the purhase of a concrete workshop. Example: purchase of workshop 01 -> additional tag: ws01, purchase of workshop 02 – > additional tag: ws02 etc.

    Is it possible witht this plugin?

    Thank you very much.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support KJ

    (@kjvextras)

    Hi! @webreneszansz thanks for reaching out. You can do this a number of ways – To be sure I help you effectively, are trying to tag customers that already exist in Mailchimp? If so, https://mailchimp.com/help/use-tag-untag-actions/ and https://mailchimp.com/help/getting-started-tags/ would be useful

    If want a user to have a custom merge tag(s) set up in Mailchimp, it will not be synced to WooCommerce until the custom filter(s) are added to the site’s functions.php file. check out this guide from our wiki on how to set that up – https://github.com/mailchimp/mc-woocommerce/wiki/Custom-Merge-Tags

    For automated tags added during checkout, take a look at this: Update Merge Tags During Order Submissions this has a code example you can reference.

    Let us know if you need any additional assistance.

    Thread Starter Webfolio Webdesign

    (@webreneszansz)

    Hi,

    Thank you very much for the detailed answer.

    The majority of the customers are already Mailchimp subscriber, but it is possible, that some new customers would like to subscribe during the shopping process.
    In this case, we need the same result, example:
    purchase of workshop 01 concrete product -> additional tag: ws01,
    purchase of workshop 02 concrete product – > additional tag: ws02 etc.

    Please be so kind and let me know, how can I setup it?

    Thank you very much.

    Thread Starter Webfolio Webdesign

    (@webreneszansz)

    Hi,
    I mean, it would be enought also without any additional tagging, if we can ceate segment based on the previously bought, concrete products. I mean, if we can send concrete newsletter only for the subscribers, who bought the  workshop 01 concrete product OR / AND
    the workshop 02 concrete product.
    Is it possible with this plugin?
    Thank you very much.

    Plugin Support KJ

    (@kjvextras)

    Hi @webreneszansz Yes!

    You will use our mailchimp_get_ecommerce_merge_tags filter

    add_filter('mailchimp_get_ecommerce_merge_tags', 'mailchimp_ecommerce_add_product_tags', 10, 2);
    function mailchimp_ecommerce_add_product_tags($merge_fields, $order) {
    $woo_order = wc_get_order($order->getId());

    // Initialize tags array
    $tags_to_add = array();

    // Loop through order items
    foreach ($woo_order->get_items() as $item_id => $item) {
    $product_id = $item->get_product_id();

    // Map product IDs to tags
    // Replace these product IDs with your actual product IDs
    $product_tag_mapping = array(
    133 => 'ws01', // Replace 123 with Workshop 01 product ID
    130 => 'ws02', // Replace 456 with Workshop 02 product ID
    178 => 'ws03', // Add more mappings as needed
    );

    // Check if this product should add a tag
    if (isset($product_tag_mapping[$product_id])) {
    $tags_to_add[] = $product_tag_mapping[$product_id];
    }
    }

    // If we have tags to add, update the merge fields
    if (!empty($tags_to_add)) {
    // Add the tags as a merge field
    // You might want to use TAGS or a custom merge field
    $merge_fields['TAGS'] = implode(',', array_unique($tags_to_add));
    }

    return $merge_fields;
    }

    And alternative for SKU usage

    add_filter('mailchimp_get_ecommerce_merge_tags', 'mailchimp_ecommerce_add_product_tags_by_sku', 10, 2);
    function mailchimp_ecommerce_add_product_tags_by_sku($merge_fields, $order) {

    $woo_order = wc_get_order($order->getId());

    // Initialize tags array
    $tags_to_add = array();

    // Loop through order items
    foreach ($order->get_items() as $item_id => $item) {
    $product = $item->get_product();
    $sku = $product->get_sku();

    // Map SKUs to tags
    $sku_tag_mapping = array(
    'WORKSHOP-01' => 'ws01',
    'WORKSHOP-02' => 'ws02',
    // Add more mappings
    );

    if (isset($sku_tag_mapping[$sku])) {
    $tags_to_add[] = $sku_tag_mapping[$sku];
    }
    }

    // If we have tags to add, update the merge fields
    if (!empty($tags_to_add)) {
    // Add the tags as a merge field
    // You might want to use TAGS or a custom merge field
    $merge_fields['TAGS'] = implode(',', array_unique($tags_to_add));
    }

    return $merge_fields;
    }

    Setup Instructions

    The code should be added to one of these locations:

    • Preferred: A custom plugin (create a simple one for this functionality)
    • Alternative: Your theme’s functions.php file (in child theme if using one)
    • Also good: A site-specific plugin or code snippets plugin
    1. In Mailchimp:
      • Ensure you have a TAGS merge field (or create a custom one)
      • Set up automation rules based on these tags if needed
    2. In WordPress:
      • Find your product IDs (hover over products in WooCommerce admin to see ID in URL)
      • Update the $product_tag_mapping array with actual product IDs
      • Add the code to your site
    3. Testing:
      • Place a test order
      • Check if the customer appears in Mailchimp with the correct tags
      • Verify in Mailchimp’s activity feed

    Important Notes

    • Tags are added when the order is placed (not just completed)
    • Multiple products in one order will add multiple tags
    • The code uses the mailchimp_get_ecommerce_merge_tags hook from the MC WooCommerce plugin
    • Make sure the Mailchimp for WooCommerce plugin is active and properly configured

    This should give them everything they need to implement product-based tagging!

    Thread Starter Webfolio Webdesign

    (@webreneszansz)

    Hi, thank you very much for the detailed answer, I really appreciate it.
    How the plugin works by default? Will we see the bought product in Mailchimp at the subscribers? Can we create segments based on the purchased conrete products?
    I mean, can we send concrete newsletter only for the subscribers, who bought the  workshop 01 concrete product OR / AND
    the workshop 02 concrete product.
    Is it possible with this plugin? I only would like to find the easiest solution, because in this case, we don’t need the additinal tagging.
    Thank you very much.

    Plugin Support KJ

    (@kjvextras)

    Hi @webreneszansz

    How the plugin works by default? Will we see the bought product in Mailchimp at the subscribers? Can we create segments based on the purchased conrete products?

    Answer: yes – here is more info from MC Support site: Getting Started with Tags: https://eepurl.com/dBYjo9 Manage Tags: https://eepurl.com/dBYjpv

    The Mailchimp for WooCommerce integration automatically syncs customer and order data, making this information available for merge tags.

    You would want to make sure you have properly mapped your merge tags to ensure the data passes over. Here is info on merge tags and how to set that up

    If you need to store and use data not automatically synced by the WooCommerce integration (e.g., a customer’s favorite product category), you can create custom fields in your Mailchimp audience and then associate custom merge tags with them.

    • Go to Audience > Settings > Audience fields and merge tags in Mailchimp to manage custom fields.

    Is it possible with this plugin? I only would like to find the easiest solution, because in this case, we don’t need the additional tagging

    Answer: yes – I have sent you information on the simplest way. Have you tried that out? Here are some additional resources:MC Quick Start videos or Complete Video Series in case you are a visual learner.

    Let us know how that goes! Here to help

    Plugin Support KJ

    (@kjvextras)

    Hi there, we’re going to close out this ticket for now since it’s been a few weeks since we’ve been in touch.

    Please let us know if you still need any help and we’ll be glad to reopen and troubleshoot further.

    Please note, that the best way to reach us is over at the GitHub plugin page: https://github.com/mailchimp/mc-woocommerce/. From there, you can receive direct responses from the development team, log new issues, download the latest version v6.0, and track existing support tickets. Thanks again!

    If you’re happy with this integration, please consider leaving a 5-star review. Your feedback helps other WooCommerce customers find this integration and helps support future development.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.