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.

How to get the shipping rates using storefront apis?

How to get the shipping rates using storefront apis?

crpatel
Shopify Partner
18 0 3
I am finding storefront APIs that is equivalent to following AJAX apis:
  • prepare_shipping_rates.json
  • async_shipping_rates.json
My Goal is to get the shipping rate while I am on the cart page.I am not able to find which APIs I need to use do make this work.
I have tried following
mutation updateDestinationAddress($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {
  cartBuyerIdentityUpdate(cartId:$cartId, buyerIdentity: $buyerIdentity){
    cart{
      deliveryGroups(first:1){
        edges{
          node {
            deliveryOptions{
              title
              estimatedCost{
                amount
              }
            }
          }
        }
      }
    }
  }
}
Input for above query:
{
  "cartId": "<<replace with some cart id here>>",
  "buyerIdentity": {
     "deliveryAddressPreferences": [
            {
              "deliveryAddress": {
                "address1": "123 Example St",
                "address2": "Apt 4",
                "city": "New York",
                "company": "Company Name",
                "country": "United States",
                "firstName": "John",
                "lastName": "Doe",
                "phone": "555-555-5555",
                "province": "NY",
                "zip": "12123"
              }
            }
          ]
  }
}
But I am not able to get any rates....

-I am working on a Hydrogen dev store, and the store is still live with liquid theme.

Replies 0 (0)