Since this post went live, I've had a few emails from readers who've experienced issues implementing this guide. After some tweaks and experimentation, we got it working on their sites. It's tricky and sometimes temperamental, but I'm confident that this method works on the majority of WooCommerce sites. I'll be updating this post with some alternate solutions just as soon as I get the time.Now we can get even more granular, allowing you to set Mailchimp segments using specific WooCommerce variations and SKUs. This could be handy for segmenting your customers based on their clothes sizing or a particular colour they go for regularly, for example.Both Mailchimp and WooCommerce say that segmenting by variations is not possible, but I've found a way without using any custom code. In this article, I'll show you how to create Mailchimp segments based on WooCommerce product variations.
We're going to start by installing a plugin to send your WooCommerce customer purchase data to Mailchimp. WooChimp does exactly this. As users buy products in your store, WooChimp will import that customer's personal data and their purchase history into a master Mailchimp list.Once you've installed and activated WooChimp, head over to WooCommerce > Mailchimp, tick "enable integration", enter a Mailchimp API key and click save.
Next, click the e-commerce tab and on the settings pane, tick "enable e-commerce", "enable orders sync", "update order status" and "subscribe all customers". Depending on your circumstances, you might want to tick "delete cancelled order data". You'll then need to select a brand-new master list that you wish all of your users and purchase data to be imported into.[caption id="attachment_26" align="alignnone" width="1720"]
Mailchimp WooCommerce settings[/caption]Note that in our tests, importing variations did not work with a list that contained existing e-commerce data; e-commerce data from two sources simply did not mix. You must create a brand new list for this integration.Before you leave, click the "automatic" tab and select "order placed" from the drop down. Select the brand-new master mailing list and connect the WooCommerce name fields to the Mailchimp name fields. If you're importing more personal data into Mailchimp, you can go ahead and connect those fields too. Click save.[caption id="attachment_27" align="alignnone" width="1006"]
Selecting mailing lists on Mailchimp Woocommerce[/caption]
SKU stands for "stock keeping unit" and like barcodes, SKUs help us and systems identify products. We'll need to enter SKUs on your product variations so that we can tell the products apart when creating our segments. Without SKUs, your variations won't show up in Mailchimp and you won't be able to segment based on these variations. WooCommerce doesn't add SKUs to your products by default, so you'll need to add these yourself or install a plugin like WooCommerce Product SKU Generator to handle this for you.To do this manually, go to each product, scroll down to the "product data" pane and click on "variations". Click each variation and enter a SKU in the uppermost field. Try and think of a SKU format that's descriptive enough for you to be able to distinguish the variation. For example, if your product is a Rick & Morty T-shirt that's available in different colours and sizes, your SKU for an extra large, black T-shirt could be "RMTS-BLACK-XL". You can use letters, numbers and symbols in your SKU.[caption id="attachment_25" align="alignnone" width="2392"]
Adding a variable product sku in WooCommerce[/caption]If you use WooCommerce Product SKU Generator, it will create an easily understandable SKU format so that you can identify products by their SKU. You can add SKUs to existing products in bulk and it will add SKUs to your new products and variations automatically.
Note that when importing product titles/variations into Mailchimp it will do so in "Name | variation SKU" format. So a Rick and Morty T-shirt in extra large & black might be imported as "rick and morty t-shirt | rick-morty-t-shirt-extra large-black".Unfortunately, Mailchimp will truncate any name and variation SKU combinations that exceed 50 characters. If you have long names or many variation attributes, your names will be truncated and you'll be unable to segment by these variations. The Rick & Morty T-shirt name would therefore be truncated to "rick and morty t-shirt | rick-morty-t-shirt-extra". Because the above product title was truncated, the colour variation has been removed and we therefore can't segment on colour.If you have long product names or many variation attributes, you'll need to create shorter SKUs manually to avoid truncation.
You can only segment your list using variations if that product variation exists in your Mailchimp list. If nobody has purchased the variation, it simply won't show in the list and you can't segment users using that purchase condition. We also can't import existing purchase data. Therefore, you need to add every single product variation to your cart and complete the checkout process so that these are imported in to Mailchimp. You can checkout using your payment gateway's sandbox mode or by enabling the cash on delivery payment option temporarily. Remember to disable these when you're done with your purchase.Once you've completed checkout, you'll need to wait 5-10 minutes for the plugin to send the new purchase data to Mailchimp.
Head back in to Mailchimp and click in to your master list. Find the account that you just made your purchases in and click the "e-commerce" tab. You should be able to see the products and variations that you just purchased.Go back to the list and click "create a segment" and in the first dropdown, select "product purchased". Now when you click onto the "select a product" dropdown, you'll see your products along with their variations. You can tell the variations based on their SKUs.