Shopify
Shopify Website
Connection
- Public App
- Protocol: OAuth 2.0
- Parameters:
- Name - (Required)
Connection name.
Shopify URL - (Required)
A *.myshopify.com URL is a web address that is assigned to your Shopify store when you sign up for Shopify.It also can be a custom domain to your Shopify store.
- Name - (Required)
Custom App
- Protocol: Api Key
- Parameters:
- Name - (Required)
Connection name.
Shopify URL - (Required)
A *.myshopify.com URL is a web address that is assigned to your Shopify store when you sign up for Shopify.It also can be a custom domain to your Shopify store.
Api Access Token - (Required)
An Api Access Token (just in case Custom app) is a unique identifier allowing you to access your custom app's Shopify APIs.
Api Secret Key - (Required)
An Api Secret Key (just in case Custom app) is a unique identifier that is needed to validate the incoming Shopify files.
- Name - (Required)
Trigger
Pull Triggers
- Shopify Schedule Pull Products.
Webhook Triggers
- Shopify Receive Updated Product.
- Shopify Receive Created Product.
- Shopify Receive Paid Order.
- Shopify Receive Updated Order.
- Shopify Receive Created Order.
- Shopify Receive Cancelled Order.
Action
- Shopify Send Created Order.
- Shopify Send Cancelled Order.
- Shopify Send Fulfillment.
- Shopify Send Inventory.
How to
Create Public App
Partners page -> Apps -> Create App -> Create app manually.
Create Custom App
Shopify Store -> Setting -> Apps and sales channels -> Develop App -> Create an app.
Register Webhook
curl --request POST \
--url 'https://{shopName}.myshopify.com/admin/api/2023-10/webhooks.json' \
--header 'X-Shopify-Access-Token: shpat_ac...' \
--header 'content-type: application/json' \
--data '{"webhook": {"address": "https://example.hostname.com/", "topic":"orders/create", "format":"json", "fields": ["id", "note"]}}'
Detect Connection
Parse X-Shopify-Shop-Domain in the header to get shopName
Check Data in Shopify
Header
Authorization:X-Shopify-Access-Token shpat_acbd6...
- Webhook
- https://{shopName}.myshopify.com/admin/api/2023-10/webhooks.json
- Order
- https://{shopName}.myshopify.com/admin/api/2023-07/orders.json
- Product
- https://{shopName}.myshopify.com/admin/api/2023-07/products.json
- https://{shopName}.myshopify.com/admin/api/2023-07/products.json
Graphql
curl --request POST \
--url 'https://{shopName}.myshopify.com/admin/api/2023-07/graphql.json' \
--header 'Authorization: X-Shopify-Access-Token shpat_acbd...' \
--header 'content-type: graphql' \
--data 'query {
products(first: 100, query: "tag:Maxi") {
edges {
node {
id
title
vendor
tags
}
}
}}'
Calculate Inventory
How to create inventory level for a Shopify Order via api?
curl --request POST \
--url 'https://your-development-store.myshopify.com/admin/api/2023-10/inventory_levels/set.json' \
--header 'X-Shopify-Access-Token: shpat_acb...' \
--header 'content-type: application/json' \
--data '{"location_id":655441491,"inventory_item_id":808950810,"available":42}'
- How to calculate inventory_item_id?
Get Variants and filter by SKU, then we will have inventory_item_id in the response. Variants API: /admin/api/2023-10/variants.json - How to calculate location_id?
Retrieve inventory_levels using inventory_item_id, which will return a list of location_ids. Then, check if the location_id exists in the destination content. If it does and is present in the response, use that location_id. Otherwise, use the first location_id from the response. Inventory Levels API: /admin/api/2023-10/inventory_levels.json?inventory_item_ids=655441491
Calculate Fulfillment
How to create fulfillment for a Shopify Order via api?
curl --request POST \
--url 'https://your-development-store.myshopify.com/admin/api/2023-10/fulfillments.json' \
--header 'X-Shopify-Access-Token: shpat_acb...' \
--header 'content-type: application/json' \
--data '{"fulfillment":{"line_items_by_fulfillment_order":[{"fulfillment_order_id":1046000794, fulfillment_order_line_items: {"id":1046000795, "quantity": 1}}],"tracking_info":{"number":"MS1562678","url":"https://www.my-shipping-company.com?tracking_number=MS1562678"}}}'
- How to calculate fulfillment_order_id?
One order will have many fulfillment orders, it is related to location/warehouse, for now we will take the first one. From order_id get the first fulfillment order by calling API: /admin/api/2023-10/orders/{order_id}/fulfillment_orders.json - How to calculate fulfillment_order_line_items/id?
get fulfillment_order > line_items to find id by variant (in Shopify Order)