Shopify Get Order Item 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 | 13.11.2024 | Bogomil | First publish |
Get Item Fulfilment Locations
We want to store for each Shopify order from which location each product should be fulfilled however we are not receiving this information with the standard Get Orders call so we will need to make a separate request for each Shopify Order. We want to store the whole order and fulfilment locations in the same time which means before we store every order in Hemi we want to get the order item locations. The end result should have a new order in Hemi with all the information which is ready for export to customers.
API Call: GET admin/api/2024-10/orders/{orderId}/fulfillment_orders.json
API Docs: https://shopify.dev/docs/api/admin-rest/2024-10/resources/fulfillmentorder#index-2020-01
Sample Request:
GET https://quickstart-aaa49619.myshopify.com/admin/api/2024-10/orders/5755198505174/fulfillment_orders.json
Orders > Marketplace Order ID should be used in the URL as {orderId}
Sample Response:
{
"fulfillment_orders": [
{
"id": 6853605195990,
"created_at": "2024-11-13T08:35:55-05:00",
"updated_at": "2024-11-13T08:36:40-05:00",
"shop_id": 69760450774,
"order_id": 5755198505174,
"assigned_location_id": 75095998678,
"request_status": "unsubmitted",
"status": "open",
"fulfill_at": "2024-11-13T08:00:00-05:00",
"supported_actions": [
"create_fulfillment",
"move",
"hold",
"split"
],
"destination": null,
"line_items": [
{
"id": 14328971493590,
"shop_id": 69760450774,
"fulfillment_order_id": 6853605195990,
"quantity": 5,
"line_item_id": 14087544996054,
"inventory_item_id": 48092186706134,
"fulfillable_quantity": 5,
"variant_id": 45996768166102
}
],
"international_duties": null,
"fulfillment_holds": [
],
"fulfill_by": null,
"delivery_method": {
"id": 1027457712342,
"method_type": "shipping",
"min_delivery_date_time": null,
"max_delivery_date_time": null,
"additional_information": {
"instructions": null,
"phone": null
},
"service_code": "custom",
"source_reference": null,
"presented_name": "Test",
"branded_promise": null
},
"assigned_location": {
"address1": "123 Main St",
"address2": null,
"city": "Toronto",
"country_code": "CA",
"location_id": 75095998678,
"name": "My Custom Location",
"phone": "555-5555",
"province": "Ontario",
"zip": "A1A 1A1"
},
"merchant_requests": [
]
},
{
"id": 6853605621974,
"created_at": "2024-11-13T08:36:32-05:00",
"updated_at": "2024-11-13T08:52:15-05:00",
"shop_id": 69760450774,
"order_id": 5755198505174,
"assigned_location_id": 75095933142,
"request_status": "unsubmitted",
"status": "closed",
"fulfill_at": "2024-11-13T08:00:00-05:00",
"supported_actions": [
],
"destination": null,
"line_items": [
{
"id": 14328972116182,
"shop_id": 69760450774,
"fulfillment_order_id": 6853605621974,
"quantity": 5,
"line_item_id": 14087544996054,
"inventory_item_id": 48092186706134,
"fulfillable_quantity": 0,
"variant_id": 45996768166102
}
],
"international_duties": null,
"fulfillment_holds": [
],
"fulfill_by": null,
"delivery_method": {
"id": 1027458138326,
"method_type": "shipping",
"min_delivery_date_time": null,
"max_delivery_date_time": null,
"additional_information": {
"instructions": null,
"phone": null
},
"service_code": "custom",
"source_reference": null,
"presented_name": "Test",
"branded_promise": null
},
"assigned_location": {
"address1": "Grodno 10",
"address2": null,
"city": "Sofia",
"country_code": "BG",
"location_id": 75095933142,
"name": "Grodno 10",
"phone": null,
"province": null,
"zip": "1000"
},
"merchant_requests": [
]
}
]
}
Mapping:
From the whole payload we need only to store only the assigned_location_id
for each Order Item Line
Shopify Field | Hemi Field | Comment | ||
---|---|---|---|---|
fulfillment_orders |
||||
id |
N/A | |||
created_at |
N/A | |||
updated_at |
N/A | |||
shop_id |
N/A | |||
order_id |
N/A | |||
assigned_location_id |
Order Item Line Shopify > Location Id | Since we do not know which exactly lines to update we want to start from the lowest id and continue to the highest one. |
New table with new field |
| | request_status
| | N/A | |
| | status
| | N/A | |
| | fulfill_at
| | N/A | |
| | supported_actions
| | N/A | |
| | destination
| | N/A | |
| | line_items
| | | |
| | | id
| N/A | |
| | | shop_id
| N/A | |
| | | fulfillment_order_id
| N/A | |
| | | quantity
| | This will indicate the quantities for the item in this location. Please note we can have an order with 1 item with 10 quantity and the quantity to be split per locations for example 5 qty in locationX and 5 qty in locationY we should store the correct assigned_location_id
for each order item line. |
| | | line_item_id
| | We need to use the Product In Order > Line Item Id from the order in order to map the correct item. |
| | | inventory_item_id
| N/A | |
| | | fulfillable_quantity
| N/A | |
| | | variant_id
| N/A | |
| | international_duties
| | N/A | |
| | fulfillment_holds
| | N/A | |
| | fulfill_by
| | N/A | |
| | delivery_method
| | N/A | |
| | merchant_requests
| | N/A | |