I am attempting to update the fulfillment status to 'fulfilled' and include additional information such as the tracking number using the Shopify API.
Currently, I can modify other fields, such as note_attributes, but I'm encountering difficulties updating the fulfillment status. I'm unsure if I should be updating the order from the following URL: https://${store}.myshopify.com/admin/api/2024-01/orders/${orderId}.json or if there's another endpoint for fulfillment updates. I am also trying to create the fulfillment to this endpoint https://${store}.myshopify.com/admin/api/2023-10/orders/${orderId}/fulfillments.json, but I encounter an 404 error.
With this code I try to create a fulfillment, but I'm not being able to do it yet.
const fulfillmentData = {
fulfillment: {
location_id: 64283476117,
tracking_number: trackingNumber,
tracking_company: "Company",
tracking_numbers: [trackingNumber],
tracking_url: `https://company.eu/EU/en/parcel-tracking?match=${trackingNumber}`,
tracking_urls: [`https://company.eu/EU/en/parcel-tracking?match=${trackingNumber}`],
status: 'success',
service: 'manual',
line_items: currentOrder.line_items.map(item => ({ id: item.id, quantity: item.quantity }))
},
};
const createFulfillmentResponse = await axios.post(
`https://${store}.myshopify.com/admin/api/2023-10/orders/${orderId}/fulfillments.json`,
fulfillmentData,
{
headers: {
'X-Shopify-Access-Token': adminApiAccessToken,
'Content-Type': 'application/json',
},
}
);
I can modify orders in this URL, but if I try to add a fulfillment, it doesn't work:
https://${store}.myshopify.com/admin/api/2023-10/orders/${orderId}.json
Thanks