You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Magento商店对接Mailchimp发送特定产品购后定时邮件技术需求

Solution: Integrate Magento & Mailchimp for Customized Email Workflows

Hey there, since you already have your email designs finalized in Mailchimp, we can focus on connecting Magento to Mailchimp and setting up the right triggers for both your requirements. Let's break this down step by step:

1. Send Your Existing Mailchimp Campaign to Specific Email Addresses

Option 1: Manual One-Time Send (Quickest)

  • Log into your Mailchimp account and navigate to the email template/campaign you've already designed
  • When setting up the campaign's recipients, choose the "Enter recipients manually" option and input the specific email addresses you want to target
  • Double-check that your pre-designed content loads correctly, then hit send—done!

Option 2: Trigger from Magento (For Automated/Batch Sends)

If you need to trigger this from Magento (e.g., via admin actions or custom logic):

  • First, make sure you have the official Mailchimp for Magento extension installed and configured with your API keys
  • You don't need to build a new email template in Magento—instead, create a "Mailchimp-linked" template in Marketing > Communications > Email Templates that points to your existing Mailchimp template ID
  • Use a custom script (or add logic to a Magento admin action) to call the Mailchimp API and send to your target emails. Here's a simplified code snippet:
    // Initialize Mailchimp API client
    $mailchimp = new \MailchimpMarketing\ApiClient();
    $mailchimp->setConfig([
        'apiKey' => 'YOUR_MAILCHIMP_API_KEY',
        'server' => 'YOUR_SERVER_PREFIX' // e.g., us17
    ]);
    
    // Create a targeted campaign
    $campaign = $mailchimp->campaigns->create([
        'type' => 'regular',
        'recipients' => [
            'list_id' => 'YOUR_LIST_ID',
            'segment_opts' => [
                'conditions' => [
                    [
                        'condition_type' => 'EmailAddress',
                        'field' => 'email_address',
                        'op' => 'is',
                        'value' => 'specific-recipient@example.com'
                    ]
                ]
            ]
        ],
        'settings' => [
            'subject_line' => 'Your Pre-Written Subject',
            'from_name' => 'Your Brand Name',
            'reply_to' => 'support@yourstore.com',
            'template_id' => 'YOUR_EXISTING_MAILCHIMP_TEMPLATE_ID'
        ]
    ]);
    
    // Send the campaign
    $mailchimp->campaigns->send($campaign['id']);
    

2. Schedule Post-Purchase Emails (Day 1, 3, 5) for Specific Product Buyers

This relies on Mailchimp's automation tools paired with Magento order data sync:

Step 1: Sync Magento Order Data to Mailchimp

  • In your Magento admin, go to Stores > Configuration > Mailchimp > Orders and enable order sync
  • Create a custom merge field in Mailchimp (e.g., PURCHASED_TARGET_PROD) to flag customers who bought your specific product
  • Add an observer in Magento to update this merge field when a customer completes an order with your target product:
    // Observer for sales_order_complete event
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();
        $targetProductIds = [123, 456]; // Replace with your specific product IDs
        $hasTargetProduct = false;
    
        foreach ($order->getAllVisibleItems() as $item) {
            if (in_array($item->getProductId(), $targetProductIds)) {
                $hasTargetProduct = true;
                break;
            }
        }
    
        if ($hasTargetProduct) {
            // Update Mailchimp contact's merge field
            $mailchimp = new \MailchimpMarketing\ApiClient();
            $mailchimp->setConfig([
                'apiKey' => 'YOUR_API_KEY',
                'server' => 'YOUR_SERVER_PREFIX'
            ]);
    
            $mailchimp->lists->updateListMember(
                'YOUR_MAILCHIMP_LIST_ID',
                md5(strtolower($order->getCustomerEmail())),
                ['merge_fields' => ['PURCHASED_TARGET_PROD' => 'YES']]
            );
        }
    }
    

Step 2: Set Up the Automated Email Sequence in Mailchimp

  • Go to Mailchimp's Automations > Create Automation > Custom Automation
  • Choose the trigger: "When a contact's merge field is updated" (trigger when PURCHASED_TARGET_PROD becomes YES)
  • Build your sequence with time delays:
    • Day 1 Email: Trigger immediately after the merge field update (or set a 1-day delay if you want it aligned to the purchase date)
    • Day 3 Email: Add a 2-day delay after the first email sends
    • Day 5 Email: Add another 2-day delay after the second email sends
  • For each email in the sequence, select your pre-designed Mailchimp template instead of building a new one
  • Add a filter to ensure only contacts with PURCHASED_TARGET_PROD = YES and valid completed orders receive the emails

内容的提问来源于stack exchange,提问作者bambamboole

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:16:39