Hello,
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.
const updateData = {
order: {
id: orderId,
fulfillment_status: 'fulfilled',
},
fulfillments: [
{
location_id: locationId,
tracking_company: 'GLS',
tracking_number: trackingNumber,
tracking_numbers: [trackingNumber],
tracking_url: `https://gls-group.eu/EU/en/parcel-tracking?match=${trackingNumber}`,
tracking_urls: [`https://gls-group.eu/EU/en/parcel-tracking?match=${trackingNumber}`],
status: 'success',
service: 'manual',
},
],
note_attributes: [
{
name: 'Order status:',
value: trackingNumber,
},
],
};
const updateUrl = `https://${store}.myshopify.com/admin/api/2024-01/orders/${orderId}.json`;
console.log('Update URL:', updateUrl);
const updateResponse = await axios.put(updateUrl, updateData, {
headers: {
'X-Shopify-Access-Token': adminApiAccessToken,
'Content-Type': 'application/json',
},
});
Could you please guide me on the correct approach or provide any insights into what might be causing the issue?
Thank you for your assistance.
Best regards