Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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)