Fulfill orders NodeJS Admin API

Fulfill orders NodeJS Admin API

thetor
Shopify Partner
1 0 0
Hi there!

I'm using the code below to try to fulfill unfulfilled orders with trackingnumbers, but it returns the following error: 

 

HTTPError: Response code 400 (Bad Request)
at Request.<anonymous> (/Users/..../node_modules/got/dist/source/as-promise/index.js:118:42)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
code: 'ERR_NON_2XX_3XX_RESPONSE',​



shopify.order.list({ limit: 5, fulfillment_status: "unfulfilled" })
    .then((orders) =>
        orders.forEach(order => {
            console.log(order);
            var trackingNumber = getTracking();

            const fulfillment = {
                tracking_number: trackingNumber,
                notify_customer: true
            }

            const fulfill = shopify.fulfillment.create(order.id, fulfillment)
            console.log('fulfill ======>', fulfill)
        })
    ).catch((err) => console.error(err));
​



Can someone guide me on what's going wrong here?

 

Replies 0 (0)