- Your supplier uses shopify.
- They are willing to expose inventory over Shopify API giving you a private app API key and Password.
- You are using fulfil and has product suppliers defined.
Read more on Fulfil support site:
pip install ShopifyAPI fulfil-client
The dependencies are also included in a requirements.txt file
pip install -r requirements.txt
The first step is to set the required credentials as environment variables.
The following environment variables are required
The shopify store name. Usually the first part of the .myshopify.com URL you use to access the store admin.
The API Key from a Shopify Private app
Password from the private app
The subdomain of your fulfil instance.
The API key of your fulfil instance. The user must have permission to read and write product suppliers.
The code of the supplier (who own the shopify store). The code can be found on the top right card on the supplier contact. Usually a number.
You can usually source a script with all the variables
export SHOPIFY_API_KEY=
export SHOP_NAME=
export SHOPIFY_PASSWORD=
export FULFIL_SUBDOMAIN=
export FULFIL_API_KEY=
export SUPPLIER_CODE=
python sync_inventory.py
This will read the environment variables, connect to shopify, match with product supplier records in fulfil and update them with the inventory available.
Sign up for Python Anywhere
You need a paid account because free accounts have restrictions on making api calls.
Navigate to files and edit the .profile
(or .bashrc
) and
include the environment variables from above.
Click on "Open bash console here" and follow the steps below:
Create a virtualenv.
mkvirtualenv shopify
Install dependencies
pip install ShopifyAPI fulfil-client
Now run the script python sync_inventory.py
If this runs, you can now setup a scheduled task to do this automatically.
Copy the path to pythin on the virtualenv. To get this just run which python
My result was /home/sharoonthomas/.virtualenvs/shopify/bin/python
- Navigate to Tasks from the dashboard.
- Paste the command
Example:
/home/sharoonthomas/.virtualenvs/shopify/bin/python /home/sharoonthomas/sync_inventory.py