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

Highlighted
New Member
9 0 0

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
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }        
      }
    }
  }
}

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
619 76 139

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 | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes