Skip to main content
More in Learn

Shopify Migration Script

This Shopify migration script is a generic Shopify to Crystallize migration script. Migrate your existing Catalogue or Orders from Shopify to Crystallize in a cleaner and faster structure.

Shopify is separating products in various Collections, making it complex as products are added. Same goes with orders, as order input thresholds can be an issue when a business starts scaling.

Set up the Configuration

The migration script requires a number of environment variables to set up before running, like your Shopify Private Storefront App and Crystallize keys. These can be passed as arguments when running the script or be setup in the lib/config.js file.

Read more on creating a Shopify Private app in the docs.

Two import modes

The script can be used to either migrate your Catalogue through Shopify’s Storefront API or your orders through a CSV file (exported from Shopify). It also includes a Single Product import logic, if you would like to test with a single product. You can find that under /catalogue/singleProductImport

To import your catalogue run:

yarn run import

To import your orders from a .csv file run:

FILE=*your-csv-file-relative-path* yarn import-orders

Shape it to your needs

From SKUs to content, every case can vary in structure and logic and you can tweak the script to fit these needs.
The core logic of the script is focused around:

  • lib/helpers/map-product.js
  • lib/helpers/map-folder.js
  • lib/helpers/format-csv-order.js
  • lib/crystallize/mutations
  • lib/crystallize/index.js

Clean information Architecture

The migration script follows Crystallize’s modern topic-based approach. Multiple categories can be associated to products by creating them as topics. Starting from top to bottom, the script will create a tree topic-structure and tag products with topics based on naming.

These can be specified as arguments in index.js file. The script behaviour can be altered in these files:

  • lib/helpers/category-filter
  • lib/crystallize/index.js (createTopics)

* Notice that by default the topics generated by the categories passed as arguments will not be included in the catalogue structure.

People showing thumbs up

Need further assistance?

Ask the Crystallize team or other enthusiasts in our slack community.

Join our slack community