Shopify GraphQL to fetch Delivery Rate for Products

upc278999
New Member
9 0 0

I'm trying to fetch products and their delivery rates from the [deliveryProfiles] object (or shipping profiles). Using the second query below I am able to pull all products that are associated with a [deliveryProfile] but I can't figure out how to fetch the Delivery Rate for each product. Our store only uses static shipping rates so I believe I need to use something like the [rateProvider] query below. But I don't know or even how to modified the query to include something like this:

 

rateProvider {
... on DeliveryRateDefinition {
                       id
                       price {
                            amount
                     }

 

Current query I'm using:

 

query {
  deliveryProfiles (first: 5) {
    edges {
      node {
        profileItems (first: 10) {
          edges {
            node {
              product {
                  id
                  handle
              }
              variants (first: 10) {
                edges {
                  node {
                    id
                    title
                    sku
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

 

0 Likes
upc278999
New Member
9 0 0

Figured it out. Here's the solution:

query {
  deliveryProfiles (first: 5) {
    edges {
      node {
        profileItems (first: 5) {
          edges {
            node {
              product {
                id
                handle
              }
              variants (first: 5) {
                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