Shopify Get Locations
Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)
Version | Date | Created / Updated | Notes |
---|---|---|---|
v1.0 | Hristiyan | First publish |
A location represents a geographical location where your stores, pop-up stores, headquarters, and warehouses exist. We can use the Location resource to track sales, manage inventory, and configure the tax rates to apply at checkout. For stock updates the location id is required to be sent as a parameter.
We want to have a button in the Account Shopify
table named “Get Locations”. This will be the trigger for the call and once pressed we want to store all the locations in Hemi. We need to create a logic and if a new location is added in Shopify we need to also add it in Hemi and vice versa if a location is removed from Shopify we need to remove it from Hemi. This can be done by comparing the id
from the response and the ids that we have already stored in Hemi. It is also possible that the location name
is changed in Shopify so if that happens we need to update the name in Hemi too.
We will need an enumeration table with a dropdown field with all the locations for the specific store.
table name | notes |
---|---|
Shopify Locations | This should be a drop-down field in Account Shopify > Location with the locations which we get from the GET locations call. |
API Documentation : https://shopify.dev/docs/api/admin-rest/2024-01/resources/location
API Call : /admin/api/2024-01/locations.json
Example response :
{
"active": true,
"address1": "126 York Street",
"address2": "Unit 42",
"city": "Ottawa",
"country": "Canada",
"country_code": "CA",
"created_at": "2008-12-31T19:00:00-05:00",
"id": 121,
"legacy": true,
"name": "Ottawa Store",
"phone": "18883290139",
"province": "Ontario",
"province_code": "ON",
"updated_at": "2009-01-31T19:00:00-05:00",
"zip": "k1n5t5",
"localized_country_name": "Canada",
"localized_province_name": "Ontario"
}
From the response we want to store the id
and name
and we want to display the name
but push the id
.
Shopify Field | Hemi Field | Notes |
---|---|---|
id |
Shopify Locations > ID |
We don’t need to see the ID in the interface but it has to be mapped in the backend to the respective |
name |
Shopify Locations > Name |
To be displayed in Hemi in the field as dropdown |