Order API - Creating unfullfilled orders

dduenas-niomads
Shopify Partner
1 0 0

Hello community!

I'm facing a trouble with a particular flow in my store. I'm using the order API [v2023-07] to create unfullfilled orders but every order is created as fullfilled.

 

I already try the next attributes in my request:

1. 
"fulfillments": [
{
"location_id": "x"
}
],
"fulfillment_status": "unfulfilled"

2. 
"fulfillments": [
{
"location_id": "x"
}
],
"fulfillment_status": null

3.
"fulfillments": [
{
"location_id": "x",

"status": "pending"
}
]

4. 

"fulfillments": [
{
"location_id": "x",

"status": "open"
}
]

 

So the requirement is to create orders with fullfillment_status: unfullfilled, but nothing works for now.

 

** Aditional to this trouble, every order created throught the API do not update the inventory... The inventory history of the product is the same, and the order is fullfilled. I hope you can help me with these small detail.

Reply 1 (1)

Liam
Shopify Staff
2731 302 783

Hi Dduenas,

 

Creating an unfulfilled order via the Shopify API doesn't require you to specify the fulfillment status, because by default, orders are created unfulfilled. You may want to ensure that you are not including any fulfillments objects in your request, as would automatically fulfill the order.

Here is an example of how your request should look:

{
  "order": {
    "line_items": [
      {
        "variant_id": "x",
        "quantity": 1
      }
    ]
  }
}

Remember to replace "variant_id": "x" with your variant ID.

Regarding the inventory not updating, Shopify doesn't automatically deduct items from the inventory when an order is created. Inventory levels are only updated when an order is marked as fulfilled.

 

If you want to decrease the inventory levels upon order creation, you can use the inventory_items endpoint.

 

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