Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

fulfillments using API Question

weap0n7
Shopify Partner
23 1 2

When I send the fulfillments API without entering the tracking_info field and then send the same api again after entering the tracking_info field
It says, "Fulfillment order 6097444962362 has an unfulfillable status= closed." How can I send tracking_info?

 

 

first send

RestAPI : https://d838a7-2.myshopify.com/admin/api/2023-07/fulfillments.json

{
	"fulfillment": {
		"line_items_by_fulfillment_order": [
			{
				"fulfillment_order_id": 6097444962362
			}
		]
	}
}

 

second send

RestAPI : https://d838a7-2.myshopify.com/admin/api/2023-07/fulfillments.json

{
	"fulfillment": {
		"line_items_by_fulfillment_order": [
			{
				"fulfillment_order_id": 6097444962362
			}
		],
		"tracking_info": {
			"number": "MS1562678",
			"url": "https://www.my-shipping-company.com?tracking_number=MS1562678"
		}
	}
}

 response

{
    "errors": [
        "Fulfillment order 6097444962362 has an unfulfillable status= closed."
    ]
}
Replies 2 (2)

Liam
Shopify Staff
2677 288 734

Hi Weap0n7,

 

If you have already created a fulfillment but omitted the tracking information, you should update the existing fulfillment instead of trying to create a new one. This can be done by using the Fulfillment API, there's an example here.

 

If your workflow requires adding tracking information at a later stage, consider changing how you handle the initial fulfillment creation to avoid closing the fulfillment order. This might involve specifying only a subset of items to fulfill in the first API call, leaving the fulfillment order open.

 

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

magenest
Shopify Partner
103 4 9

Hi @weap0n7 

You are using the API incorrectly. After creation, you should use the API to update the status, but you used the API to create fulfillment again, leading to an error. Check the endpoint: https://shopify.dev/docs/api/admin-rest/2023-10/resources/fulfillment#post-fulfillments-fulfillment-...

Magenest - One-stop Digital Solution Provider
- Don’t forget to drop a thumbs-up and Mark it as a Solution if you find our response useful
- Elevate your online business with our Shopify experts and professional designers