lbk
May 12, 2022, 9:15pm
1
How do I update the order tracking numer, links and shipping provider?
The example looks good but where do i get the fulfillmentID from?
export function updateFulfillment(orderId, fulfillmentId) {
return wixStoresBackend.updateFulfillment(
orderId,
fulfillmentId,
trackingInfo
)
.then((updatedOrder) => {
// Fulfillment updated
const orderFulfillmentStatus = updatedOrder.fulfillmentStatus
})
.catch(error => {
// Fulfillment not updated
console.error(error)
})
}
Thanks a lot!!
Lawrence
Hello from the Wix DevRel Team!
If you’re also using our createFulfillment function (which I believe you should be for this example to work), the fulfillmentId is created as part of the promise in line 16:
https://www.wix.com/velo/reference/wix-stores-backend/createfulfillment
From the documentation linked above:
export function createFulfillment(orderId) {
13 return wixStoresBackend.createFulfillment(orderId, fulfillment)
14 .then((updatedOrder) => {
15 // Fulfillment created
16 const fulfillmentId = updatedOrder.id
17 const orderId = updatedOrder.order._id
18 const fulfillmentStatus = updatedOrder.order.fulfillmentStatus
19 })
20 .catch(error => {
21 // Fulfillment not created
22 console.error(error)
23 })
24}
Hope this helps!
Rob
Good morning, how would you have to implement this code so that a user, when entering his purchase number, gives him the information of his tracking number.