Search code examples
shopifyshopify-app

Shopify Carriers API assign services to countries


Shopify experts are not able to reply this. This question is about Shopify app development. This app is regarding adding custom carrier services to show real time shipping rates.

I added (Shopify API Documentation Ref: CarrierService):

url: store_url."/admin/carrier_services.json"

Posted Data:

{
  "carrier_service": {
  "name": "My Carrier",
  "callback_url": "http:\/\/blablabla.com",
  "service_discovery": true
  }
}

Now, the carrier is created and returns quotes as well. Everything is working fine.

There is just one issue: When we add any custom carrier to the shipping zone. Either it shows invalid services list i.e. services of Shopify default USPS, FedEx, or UPS services list OR shows:

There are no available services for the country you have selected Grammatically, there is no any way to add carriers to shipping zones. I am wondering: how Shopify decides what to show? This services list is also added in shipping zones, which is read only according to API.

Logically, it should either get services while creating a new carrier and show them, OR simply show any message which represents that custom carrier services will be available.

Invalid services from Shopify default carriers: Invalid services from Shopify default carriers

No services & wrong message: No services & wrong message


Solution

  • Set a static response on carrier service url (in this case "http://blablabla.com") it will set services automatically. Once they are visible in shipping zones then you can make them dynamic.