Rest API how set order as delivery

Ggarret
Visitor
3 0 0

 

Hello everyone,

I'm trying to import orders via the REST API, and I would like them to be marked as "delivered." The orders are linked to a "company," which is, in turn, associated with a customer.

 

I've tried several methods, such as creating an order and then updating the fulfillment order object with a "shipment_status" of "delivered." However, the API responds that there is no location.

 

Then, I used the /fulfillment routes, and I can successfully add a tracking code, but I can't update the status. (By the way, I couldn't find any documentation regarding a possible PUT method, even though it's mentioned in this post: https://community.shopify.com/c/fulfillment-and-inventory/api-for-updating-the-delivery-status-of-an...

 

The ideal scenario would be to import orders directly with the correct status without having to manipulate other routes. Do you also think that the concept of "company" could potentially pose a problem? I've noticed that it's often less well-documented in the REST API compared to the GraphQL API.

Do you have any ideas?

Thank,
Guillaume

Replies 2 (2)

Liam
Shopify Staff
2731 302 777

Hi Guillaume,

The error message regarding no location likely means that a fulfillment location has not been assigned to the order. Each order should be associated with a location, which represents where the order is to be fulfilled from. This is usually either a merchant's location or a third-party location like a warehouse.

 

When creating an order, you should include the location_id in your request body. This ID is a unique identifier for the location associated the order. You can retrieve a list of all locations associated with a shop by making a GET request to the admin/api/{version}/locations.json endpoint.

 

After the order is created, you can use the Fulfillment API to mark the order as delivered. The Fulfillment API allows you to create fulfillments for an order, which includes updating the shipment status.

 

When creating a fulfillment, you should specify the status as delivered, tracking_numbers with the tracking numbers for the order, and tracking_urls with the corresponding URLs where the tracking number can be used to track the shipment. The location_id should also be included in the fulfillment creation request.

 

I hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Ggarret
Visitor
3 0 0

Hello, thank you very much, your solution works. I hadn't understood the nuance of the location_id, which I thought was the customer's address, not our warehouse's.

 

Thank you very much,
Guillaume