One of the most common issues found across the ecommerce ecosystem lies within how to integrate WooCommerce and Shopify.
This happens for two reasons.
The first one is that many store owners use multiple platforms to sell their products, but rely on Shopify to manage the orders originating in other platforms.
The second reason lies within the shortcomings present in the available solutions. While some can be quite expensive to implement, others simply fail to live up to what store owners need to accomplish.
One thing is certain: integrating WooCommerce and Shopify isn’t the easiest task, but we are here to show you how to do it using Integromat.
In the following use case, certified Integromat Partner Andy O’Neil explains how to create multi-product orders on Shopify from incoming WooCommerce orders.
In other words, we will look at how to transfer sales from WooCommerce to Shopify.
Now, before we start, please note that this is an advanced scenario, and you will need an Integromat account to create the integration. If you don't have one yet, please register for free.
To create this integration, you will need the following:
- Integromat account
- Shopify account
- WooCommerce account
Below you will find a summary of the Integromat modules that we will use to create the scenario.
After we introduce these, we will go into the details of each step, so you can recreate the scenario in your own Integromat dashboard.
1. WooCommerce » Watch Orders [Scenario Trigger]: This module will watch WooCommerce for new orders.
2. WooCommerce » Get an Order [Action]: This module will retrieve new WooCommerce orders, and use the data in these to build formatted data for the line items on the Shopify order.
3. Flow » Iterator [Action]: This module will iterate through the line item array from the WooCommerce order. This is necessary to reconstruct the data for Shopify.
4. JSON » Parse JSON [Action]: This module will parse the individual line items from the WooCommerce order.
5. JSON » Aggregate to JSON [Action]: This step will recreate the line items in the correct data structure for Shopify.
6. JSON » Parse JSON [Action]: This module will parse the formatted JSON line item that will be aggregated to create the Shopify order.
7. Flow » Array Aggregator [Action]: This module will aggregate the Shopify line item JSON values into an array, which will be used to create multiple line items (products) on the Shopify order.
8. Shopify » Create an Order / Draft Order [Action]: This final module creates the order on Shopify with the items that were included on the original WooCommerce order.
Building the Scenario
Now, time to get into the action. Here we will show you how to build the scenario; keep an eye open for details or save this use case for later reading, as it requires a bit of patience!
1. Watch WooCommerce orders
WooCommerce provides the product list (or line items) in the form of an array, which is a nested bundle of data that is attached to order data.
In this step, we will simply watch WooCommerce for new orders that will be added to our Shopify store.
NOTE: Some filters may be required to only get paid active orders.
2. Get WooCommerce orders
This may seem redundant, but you will need to lookup your WooCommerce order again. This will ensure that you will have access to:
- WooCommerce order data
- Product line item data
To create the Shopify order at the end of your scenario.
To do this, add the WooCommerce “Get an Order” module to your scenario, then map the Order ID from the first step into the Order ID field of this module (see image below).
3. Iterating line items from WooCommerce
Next, you will add an Iterator module. Setting up this module is easy, you will simply find the “Line Items” array from your previous “Get an Order” module, and add it to the Iterator module.
The iterator will:
- Take the line items array
- Separate it into as many line items that were included in your order
For example, if your order included 5 items, the iterator will separate the 1 array into 5 line items.
4. Parse line items from the iterator
Next, we need to parse the structured JSON data packets we received from the iterator module.
This is simple to map: just add “Value” from the iterator module into the JSON string field within the “Parse JSON” module.
NOTE: There is no need to define a data structure for this module (you can ignore that).
5. Aggregate line item data to Shopify format
In the next step, we must create the exact JSON data structure that Shopify requires to create line items for your order.
This step has several sub-steps, but don’t worry - they aren’t as hard as they might look.
5.1 Add the “Aggregate to JSON” module to the scenario
Here we will add the Shopify JSON data structure.
After adding the “Aggregate to JSON” module to your scenario, do the following:
- Click on the module
- Set your “Source Module” to the previous step (Parse JSON)
- Click “Add”
Next, give your data structure a name in the “Data structure name” field.
Then click the “Generator” button.
Next, make sure that “Content type” is set to “JSON”.
After that, make sure you do the following:
- Paste the JSON code (provided below) into the “Sample data” field
- Click “Save”
Copy and paste this sample JSON code into the Generator » Sample Data field:
After you click “Save”, your JSON data structure will appear in the “Add data structure” box:
Here, you must click “Save” to finish up the data structuring step.
Once you save this, you should see that your data fields have been automatically generated.
These fields will be used to create the structured data required for your Shopify line items.
If everything looks good, then click “Save” on the “Add data structure” box.
5.2 Map WooCommerce fields to Shopify
Next, you will have to map the data fields from your WooCommerce line items (from the “Parse JSON” module) to the “Aggregate to JSON” module using your Shopify line item JSON structure.
Sounds hard? Let us show you how to do it 😊
NOTE: The labels from your WooCommerce order might have different names than your Shopify data structure.
6. Parse the “Shopify JSON” module
To do this, you will need to add the “Parse JSON” module to your scenario. After that, please follow these steps:
- Click on the module
- Map the JSON string from the previous step into the “JSON String” field
- Click “OK” to save
That’s it! Now let’s keep moving forward.
7. Aggregate Shopify JSON structure
Now that we have the line items properly formatted and separated into bundles, we must aggregate these bundles into a single bundle to create our Shopify order.
To complete this step, you will need to do the following:
- Add an “Array aggregator” module to your scenario
- Select the “Watch orders” WooCommerce module as your “Source module
- Select the fields you want to aggregate to Shopify. Here, you will select every field from the previous step (Parse JSON).
NOTE: You will have to run your scenario once to see these fields from the previous step.
Once you have selected each field from the previous Parse JSON step, click “OK” to save.
8. Create the Shopify order
We are close to fully creating this integration!
To proceed, add a “Shopify Create Order” or “Create Draft Order” module to your scenario and create (or select) the connection to your Shopify store.
Next, you will have to turn on the “map” button under “line items”, because we will have to map data from the array aggregator step to create the line items for this order.
To do this, map the “Array[ ]“ value from the previous array aggregator step into the “Line Items” field.
This array will create multiple products on your order, regardless of the number of products that were purchased on the WooCommerce order.
Next, map the rest of your order as needed.
NOTE: You may have to lookup your initial WooCommerce order again to gain access to the general order values.
And that’s it!
Now save your Integromat scenario and turn it on to automatically create multi-line Shopify orders for your WooCommerce store orders.
While this use case is focused on transferring multi-product orders from WooCommerce orders to Shopify, you can use it to do the same for other platforms - such as Etsy, PrestaShop, or Magento.
The basic principles are the same, so don’t be afraid to tweak the initial modules (watch and get orders) to suit your needs.
More ideas for your business