Shopify API Integration

Created by Migration Bot, Modified on Wed, 21 Oct at 1:10 PM by Migration Bot

Originally written by Former user, last updated Jul 06, 2021, on the Swan Retail knowledge base (SRS).


The Shopify API integration within SRS enables sending of product information and web hierarchy from SRS and sharing of order information.

This document details the functionality of the integration and how this works within SRS

Products

Shopify API Documentation: https://shopify.dev/docs/admin-api/rest/reference/products/product#create-2021-04

SRS sends items to Shopify if they are checked as Web Enabled within Item Maintenance. Any changes to Web Enabled items will result in an update being sent to Shopify.

Removing the Web Enabled indicator will cause the item to be removed from Shopify.

The web branch is taken from the value within the shopify_integration table. Only items marked as Web Enabled at this branch will be sent to Shopify.

The web factor (the percentage of inventory that is made available to the web) is set within Company Maintenance.

As well as sending item information, inventory levels are also sent on any newly web enabled items or updates to existing web enabled items.

Create Product

POST /admin/api/{api_version}/products.json

There are multiple options when creating products depending on the setup within SRS. These include:

  • Creation of a new product

  • Creation of a product with variants

For products with variants, the parent product is created in Model Maintenance and the variants are created as Items in Item Maintenance and assigned to the Model.

For models with variants the model is created first and then the variants are sent to Shopify

POST /admin/api/{api_version}/products/{product_id}/variants.json

Images are sent to Shopify separately once the Product has been created.

POST /admin/api/{api_version}/products/{product_id}/images.json

Update Product

Product updates are triggered by amending a web enabled item in Item Maintenance or Model in Model Maintenance.

PUT /admin/api/{version_id}/products/{product_id}.json

The fields for the Update endpoint are the same as those used for the Create.

Delete Product or Variant

Deleting a product in SRS will delete it from shopify

DELETE /admin/api/{api_version}/products/{product_id}/variants.json

Delete Images

Whenever images are removed from the Item or Model, the associated products are updated on Shopify without the images that have been removed.

Stock Levels

Updated stock levels are sent to Shopify for an item whenever that item is web enabled or (already being web enabled) updated. This stock level is worked out from the web branch and the value of the Web factor as set in Company Maintenance.

Orders

Shopify API Documentation: https://shopify.dev/docs/admin-api/rest/reference/orders/order

Get Orders

Orders are pulled down from Shopify on a schedule. Orders are retrieved based on the ID of the last order retrieved from Shopify (this is stored in the database in the shopify_order table).

GET /admin/api/{api_version}/orders.json?since_id={last_retrieved_id}

This endpoint can take any of the following as a parameter:

Parameter

Description

since_id

The Shopify ID of the last order to be retrieved from Shopify.

This is stored in the shopify_order table, shopify_order_number field

created_at_min

The time of the last check for orders

limit

Defines a maximum number of results to return

Web Hierarchy

Shopify API Documentation: https://shopify.dev/docs/admin-api/rest/reference/products/smartcollection

The Web Hierarchy setup within SRS is sent to Shopify as a Smart Collection. The link between an SRS Web Hierarchy and a Shopify Smart Collection is held within the database in the shopify_web_hierarchy table.

Any changes to Web Hierarchy within SRS result in a POST of the hierarchy to Shopify.

There is no way to delete a hierarchy from Shopify within SRS. Instead make any changes required to the hierarchy within SRS and save. This will result in the hierarchy being resent to Shopify.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article