Re: Getting Shipping Carrier Method names using GraphQL query

Solved

Getting Shipping Carrier Method names using GraphQL query

zainabraja
Shopify Partner
2 0 0

How can I get the Shipping Carrier method names by using the Shopify GraphQL query (GET API) instead of GraphQL mutation?

Let me explain what I'm trying to do:

I am using the availableCarrierServices GraphQL query to fetch the available Shipping Carrier names that are present in my Shopify Store. See the screenshot below.

Screenshot from 2023-11-30 11-52-21.jpg


In the above screenshot, the response from the availableCarrierServices returns only Shipping Carrier names, but I also want to get the method names of the Carriers. for example: "UPS Ground", "UPS Next Day Air", etc.

Also, there aren't any objects that let me fetch the Shipping Carrier method names in this API query.

Screenshot from 2023-11-30 11-42-02.jpg


In the above Screenshot, I can get the Shipping Carrier methods names using the draftOrderCalculate GraphQL mutation, But I want to fetch the Shipping Carrier methods names using GraphQL query (GET API) instead of a mutation.

Can anyone help me with figuring this out? Thank You.

Accepted Solution (1)
SBD_
Shopify Staff
1831 273 419

This is an accepted solution.

Hey @zainabraja 

 

From some API support folks:

----

I’ve confirmed this on my own test store with the following query. Please note that the `origins` and `restOfWorld` arguments are required. If you want to see the rates for a specific country you can add the `countryCodes` argument and set `restOfWorld` to false.

query{
    availableCarrierServices{
      carrierService{
        formattedName
        availableServicesForCountries(origins: "gid://shopify/Location/52415234070", countryCodes:CA, restOfWorld:false){
          name
        }
      }
    }
}
 
Here are the related resources in our Shopify.dev documentation as well:

Scott | Developer Advocate @ Shopify 

View solution in original post

Replies 3 (3)

SBD_
Shopify Staff
1831 273 419

Hey @zainabraja 

 

Checking on this one.

Scott | Developer Advocate @ Shopify 

SBD_
Shopify Staff
1831 273 419

This is an accepted solution.

Hey @zainabraja 

 

From some API support folks:

----

I’ve confirmed this on my own test store with the following query. Please note that the `origins` and `restOfWorld` arguments are required. If you want to see the rates for a specific country you can add the `countryCodes` argument and set `restOfWorld` to false.

query{
    availableCarrierServices{
      carrierService{
        formattedName
        availableServicesForCountries(origins: "gid://shopify/Location/52415234070", countryCodes:CA, restOfWorld:false){
          name
        }
      }
    }
}
 
Here are the related resources in our Shopify.dev documentation as well:

Scott | Developer Advocate @ Shopify 

zainabraja
Shopify Partner
2 0 0

Thank you so much!