MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
954 stars 280 forks source link

Unable to create fulfillment #623

Open alihamza1214 opened 1 year ago

alihamza1214 commented 1 year ago

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 commented 1 year ago

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

swherden commented 1 year ago

Same problem here - as shopify changed the Fulfillment API

alihamza1214 commented 1 year ago

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 .

swherden commented 1 year ago

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.

alihamza1214 commented 1 year ago

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.

enchorb commented 6 months ago

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: '.....'
            }
          }
        })
      }
    );