Shopify with FTP (Part 2)
Taking the shipment data back from FTP to Shopify.
In our first Shopify to FTP tutorial (part one) we looked at moving data from Shopify out to an FTP server as a CSV file. In this second part we will look at moving data back from the FTP location to update Shopify. To follow on from part one, in this part we will move shipment data back from the FTP to complete the sales order loop, ensuring that orders in Shopify are kept up-to-date with what the 3PL has shipped.
This tutorial should be followed to create a data stream back from the FTP location to Shopify. These steps assume that you have the following accounts and information to hand:
In part one of this tutorial two keys were created, these should be in your HighCohesion account as:
- FTP Key
- Shopify Key
No additional keys are required for this second part.
A source is where the data will be coming from. To create a source log in to Control Panel and select sources from the right side panel and select Create Source. To create a source you will need the following information below.
- Title - Enter a title for the source, e.g. Get FTP Shipments
- System - Select FTP from the systems list.
- Function - Select function from dropdown in this case
- Key - Select the FTP key that was created in step 1 above.
- Trigger - Choose an option from the drop down list, either Manual, Scheduled or Web hook. For the purpose of the tutorial we are going to select "Manual", however after the smoke test in step 6 you may want to change this to scheduled.
- Settings - Add the following setting so that the source will only collect files that start with the prefix
SHP_and are located in the folder
/outbound/shipmentson the FTP. The setting
archivewill also move the file to an archive folder on the FTP once collected.file_prefix = "SHP_"file_type = "csv"remote_path = "/outbound/shipments"move_remote_file = "archive"
For the scenario in this tutorial we are going to get a shipments CSV file from our dummy 3PL FTP. However this same process could be used for any other information coming from FTP, such as Products, Customers, Discounts etc, these would just require a different Function / Setting on the destination side.
The destination is where the data will be streamed to after it has been transformed. To create a destination log in to Control Panel and select Destinations from the right side panel and select Create Destination. To create a Destination you will need the following information:
- Title - Enter a title for the destination, e.g Shopify Post Shipments
- System - Select Shopify from the systems list.
- Function - Select function from dropdown in this example
- Key - Select the Shopify key that was created in step 1 above.
- Trigger - From the dropdown list select "Real Time".
- Settings - Leave empty, no additional settings are required.
The transformation file is required to translate data between the source system format and destination system format. To create a transformation file log in to Control Panel and select Transformations from the right side panel and select Create Private Transformation. The transformation creation screen gives the following inputs:
- Title - A meaningful title e.g "Shopify x FTP CSV :: Sales Order Data"
- Source - Choose the source system from the dropdown list, Shopify in this case.
- Destination - Choose the destination system from the dropdown list, FTP in this case.
- Primary Data Type - The data type will be what data is being streamed e.g order, product, payment etc... in this example the data type will be order.
- Content - This will contain the mapping file which translate between the source and destination, for details on how to create a transformation file please check this link. For this example, please paste in the transformation below:
The transformation file logic above is the simplest form of shipment data to be sent to shopify and has been built to work with the example smoke test CSV file shown below in part 6a. This transformation maps the order number and tracking number from the smoke test CSV file in to the Shopify fulfilment format.
Step five in the process is to configure the our data stream. The stream in HighCohesion terms is the part that brings all of the settings together in to an active integration. To set this up, select the Streams option from the left hand navigation. Then on the next page press the "Create Stream" button at the top right side of the page. On the next page, complete the following settings:
- Title - Create a title for the stream: "[SH-1201] FTP CSV x Shopify for Shipments".
- Description - Optional, e.g. "FTP to Shopify for shipments."
- Source - From the dropdown, select the destination "Get FTP Shipments", as created in step 2 above.
- Transformation - from the dropdown select the private transformation file that was created in step 4 above.
- Destination - From the dropdown, select the destination "Shopify Post Shipments", as created in step 3 above.
- Data Type - For the data type enter:
- Active - Tick this option to activate the stream.
location_id = 1234567890
In order to test this data stream you will need to place a Shipments file in the
/outbound/shipments/receivedfolder on the FTP. There is an examples CSV file attached below. Once you have uploaded this file to the FTP, goto the Streams list, press the view link on the
[SH-1201] FTP CSV x Shopify for Shipmentsstream. Then from the stream view page, click on the Manual Run option from the "Actions" dropdown (top right of page).
This action will create a Job that will collect the file from the FTP and then create a Shipment event. The event will be visible on the Events list page. If all has gone correctly, the event in HighCohesion will be marked as
okand the order in Shopify will be marked as Fulfilled.
Copy the data below in to a text editor and save as a CSV file. This will then create your example shipments file that can be uploaded to your FTP for the smoke test. Please remember to change the order numbers in the first column to match the test order number(s) in your Shopify store.
Congratulations, you are now setup and ready to enjoy a working 3PL shipments integration for Shopify.
Can I customise the attributes in the transformation files specific to my store? Yes! Follow this link to our guide about how to customise transformation files with specific examples.