Hi all. I need to be able to programmatically do the following:
I have tried https://www.wix.com/velo/reference/wix-stores-backend/createfulfillment - but nothing seems to happen, I don’t appear to get any errors either. The order remains Unfulfilled and no shipping email is sent.
Is this a constraint of Wix/Velo? Am I using the wrong Velo code for this? This is what I’ve tried so far…
Backend:
import wixStoresBackend from ‘wix-stores-backend’ ;
const fulfillment = {
“lineItems” : [{ “index” : 1 , “quantity” : 1 }],
“trackingInfo” : {
“shippingProvider” : “testshipper” ,
“trackingLink” : “https://www.test.com” ,
“trackingNumber” : “12345”
}
}
export function doSomething ( orderId , buyerId ) {
**return** wixStoresBackend . createFulfillment ( orderId , fulfillment )
. then (( updatedOrder ) => {
// Fulfillment created
const fulfillmentId = updatedOrder . id
const orderId = updatedOrder . order . _id
const fulfillmentStatus = updatedOrder . order . fulfillmentStatus
})
. catch ( error => {
// Fulfillment not created
console . error ( error )
})
}
Frontend:
import { doSomething } from ‘backend/sendfulfillment’
doSomething ( item . orderId , item . buyerID )
