I’m trying to update an order in Shopify as fulfilled.
I’m using the Javascript code by Zapier rather than the custom actions. But I’ve tried both.
I tried using both the order and the filfillment IDs.
Each order has multiple line items but I want to update the entire order.
This is the code I’m using.
It runs and doesn’t return an error, but the order isn’t fulfiled.
(Oh, I added the output because Zapier 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': '*******'
},
body: JSON.stringify({
"fulfillment_order": {
"id": fulfillmentOrderId,
"status": newStatus
}
})
}
);
const data = await response.json();
console.log(data); // Handle the response as per your requirements
};
updateFulfillmentStatus();
output=updateFulfillmentStatus()
Best answer by Irit Levi
View original