GraphQL Query to fetch Products and their 'default' shipping rate at checkout?

GraphQL Query to fetch Products and their 'default' shipping rate at checkout?

upc278999
Tourist
9 0 3

I'm trying to pull products and the 'default' delivery rate for each product at checkout. Our Delivery Profiles have multiple 'rates' but only one is auto-selected at checkout. That's the rate I need. The query below pulls the first 5 products from a specific delivery profile but it shows all the available rates for the entire profile. Is it possible to only retrieve the rate auto-selected at checkout for each product? Also we only use static rates not dynamic.

query  {
  deliveryProfiles (first: 1, after: "eyJsYXN0X2lkIjo0NjQ4Njg0NzUzOSwibGFzdF92YWx1ZSI6IjQ2NDg2ODQ3NTM5In0=") {
    edges {
      node {
        profileItems (first: 5) {
          edges {
            cursor
            node {
              product {
                title
              }
              variants (first: 1) {
                edges {
                  node {
                    id
                    title
                   }
                 }
               }
            }
          }
        }
        profileLocationGroups {
          locationGroupZones(first: 5) {
            edges {
              node {
                methodDefinitions(first: 5) {
                  edges {
                    node {
                      rateProvider {
                        ... on DeliveryRateDefinition {
                          id
                          price {
                            amount
                          }
                        }
                        ... on DeliveryParticipant {
                          id
                          fixedFee {
                            amount
                            currencyCode
                          }
                          percentageOfRateFee
                          participantServices {
                            active
                            name
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }        
      }
    }
  }
}

 

Reply 1 (1)

_JB
Shopify Staff (Retired)
836 100 223

Hey @upc278999,

That query doesn't allow filtering on the actual rates, so the only option right now will be to retrieve all rates and get the one you need. The checkout always pre-selects the least expensive rate.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog