Medusa Source Shopify
Plugin that allows users to source Medusa using a Shopify store.
Quick start
This plugin will copy all of your products and collections from Shopify to Medusa.
To get started with the plugin you should follow these steps.
Install the plugin
Navigate to your Medusa server in your terminal, and install the plugin.
12$ cd my-medusa-server$ yarn medusa-source-shopify
Create a Shopify app
Navigate to your Shopify dashboard, and then go to Copy to clipboard
Apps
and click the Copy to clipboardDevelop apps for your store
button at the bottom of the page. After navigating to the Copy to clipboardApp development
page, click the Copy to clipboardCreate an app
in the top right corner.This should open a modal where you can choose a name for your app. Write a name and click Copy to clipboard
Create app
.You should then click the button that says Copy to clipboard
Configure Admin API scopes
. Scroll down to Copy to clipboardProducts
and select the Copy to clipboardread_products
scope, and then save your changes.Go back to overview and click Copy to clipboard
Install app
. This should generate a token, that you should write down as you can only view it once.Add the required plugin options
Update your Copy to clipboard
medusa-config.js
with the following:1234567891011121314//Shopify keysconst SHOPIFY_STORE_URL = process.env.SHOPIFY_STORE_URL || "";const SHOPIFY_API_KEY = process.env.SHOPIFY_API_KEY || "";const plugins = [// other plugins...{resolve: `medusa-source-shopify`,options: {domain: SHOPIFY_STORE_URL,password: SHOPIFY_API_KEY,},},];
You should then add Copy to clipboard
SHOPIFY_STORE_URL
and Copy to clipboardSHOPIFY_API_KEY
to your Copy to clipboard.env
.12SHOPIFY_API_KEY=<your_secret_shopify_key>SHOPIFY_STORE_URL=<your_store_name>
The Copy to clipboard
SHOPIFY_API_KEY
is the token that we generated in the previous step. Copy to clipboardSHOPIFY_STORE_URL
is the name of your store. You can view the name in the url of your Shopify dashboard, which has the following format Copy to clipboard<your_store_name>.myshopify.com
.Run your server
After setting everything up you can now run your server
1$ yarn start
and the plugin will handle the rest.
Note
The plugin only queries updates since last build time
The plugin stores everytime it is run, and will use this timestamp to only fetch products, collections and collects that have been updated in Shopify since the last time it pulled data.
Copy to clipboardProduct/Collection
relations (Copy to clipboardCollect
)
Shopify supports products being part of more than one collection, but Medusa does not support this. For this reason a product will only be part of the first collection it has a relation to in Medusa. The plugin processes Shopify product/collection relations in the following order:
- Custom collections
- Smart collections
This means that if product Copy to clipboard
X
is part of custom collection Copy to clipboardY
and smart collection Copy to clipboardZ
in Shopify, it will only be added to custom collection Copy to clipboardX
in Medusa.