How to get the shipping rates using storefront apis?

How to get the shipping rates using storefront apis?

chiragramjibhai
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)