Shopify-api-node icon indicating copy to clipboard operation
Shopify-api-node copied to clipboard

Unable to create fulfillment

Open alihamza1214 opened this issue 2 years ago • 6 comments

We were using create fulfillment resource which was working fine until now. We believe that shopify have changed resources after version 2022-10 so may be it has to do something with that.

await shopify.fulfillment.create('1323', {
   notify_customer: false,
   location_id: '',
   tracking_number: '',
   tracking_url: '',
   tracking_company: 'Other',
 })

this was the format that was working before but now its giving 404 not found and if we provide new params format from shopify admin rest api doc, it gives bad request.

https://store-test.myshopify.com/admin/api/2023-01/fulfillments.json
    "fulfillment": {
        "line_items_by_fulfillment_order": [
            {
                "fulfillment_order_id": 123123131
            }
        ],
        "tracking_info": {
            "number": "123123",
            "url": "https://www.my-shipping-company.com?tracking_number=1231"
        }
    }
}

above code snippet works from direct postman call but we are not able to figure out how to make this call using this package.

alihamza1214 avatar Jul 31 '23 09:07 alihamza1214

even tried with this json mentioned in tests { "fulfillment": { "tracking_number": null, "line_items": [ { "id": 466157049, "quantity": 1 } ] } }

alihamza1214 avatar Jul 31 '23 09:07 alihamza1214

Same problem here - as shopify changed the Fulfillment API

swherden avatar Aug 08 '23 09:08 swherden

Same problem here - as shopify changed the Fulfillment API

Yes but the package is still making old API calls and there is no recent update .

alihamza1214 avatar Aug 08 '23 11:08 alihamza1214

Correct, but shopify seems to reject old API calls regarding fulfillment. Tried also the createv2 method but also not working.

I will gonna change it to the new API with a lot of effort and directly with the shopifyAPI.

swherden avatar Aug 08 '23 15:08 swherden

Correct, but shopify seems to reject old API calls regarding fulfillment. Tried also the createv2 method but also not working.

I will gonna change it to the new API with a lot of effort and directly with the shopifyAPI.

Yes we are also using direct admin API call to create fulfillment and its working but if its fixed in package then it will be good because we are using many other APIs in our project.

alihamza1214 avatar Aug 09 '23 10:08 alihamza1214

Any ETA on a fix here, the below works for now

    const [fulfillment] = await shopify.order.fulfillmentOrders(id);
    await fetch(
      `https://${config.shopify.name}.myshopify.com/admin/api/${SHOPIFY_API_VERSION}/fulfillments.json`,
      {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'X-Shopify-Access-Token': config.shopify.token
        },
        body: JSON.stringify({
          fulfillment: {
            line_items_by_fulfillment_order: [{ fulfillment_order_id: fulfillment.id }],
            tracking_info: {
              number: '......',
              url: '.....'
            }
          }
        })
      }
    );



enchorb avatar May 04 '24 15:05 enchorb