I’m trying to update an order in Shopify as fulfilled.
I’m using Javascript code.
I tried using both the order and the filfillment IDs.
Each order has multiple line items but I want to update the entire order. And the API documentation says if you update the fulfillment ID and not specify line items it will fulfill the entire order.
This is the code I’m using.
It runs and doesn’t return an error, but the order isn’t fulfilled.
(Oh, I added the output because the tools I am using requires it, but I really don’t need it)
Help….
const fulfillmentOrderId = 'f_ID';
const newStatus = 'FULFILLED'; // or 'partial'
const updateFulfillmentStatus = async () => {
const response = await fetch(
`https://******.myshopify.com/admin/api/2024-01/fulfillment_orders/${fulfillmentOrderId}.json`,
{
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'X-Shopify-Access-Token': 's****_******'
},
body: JSON.stringify({
"fulfillment_order": {
"location_id": "123456789",
"id": fulfillmentOrderId,
"status": newStatus
}
})
}
);
const data = await response.json();
console.log(data); // Handle the response as per your requirements
};
updateFulfillmentStatus();
output=updateFulfillmentStatus()
2
Answers
Here's the code I'm using. It works in theory, only I keep getting a response of OrderID not found
There is no such thing as fulfillment order updates like that. If you want to make a fulfillment, use the mutation fulfillmentCreateV2 where you provide the fulfillment order ID and anything else of any interest. Not sure where you got your ideas from here, but there is nothing matching in the docs far as I can tell. I have fulfilled a few million orders using fulfillmentCreateV2, so I can attest to the fact that it is simple and just works.