如何解决Shopify GraphQL获取产品的交货率
我正在尝试从[deliveryProfiles]对象(或运输配置文件)中获取产品及其交付率。使用以下查询,我可以提取与[deliveryProfile]关联的所有产品,但是我不知道如何获取每种产品的交货率。我们的商店仅使用静态运费,因此我认为我需要使用类似下面的[rateProvider]查询。但是我不知道,甚至不知道如何修改查询以包含这样的内容。
rateProvider {... on DeliveryRateDefinition {id price {amount}
我正在使用的当前查询:
query {
deliveryProfiles (first: 5) {
edges {
node {
profileItems (first: 10) {
edges {
node {
product {
id
handle
}
variants (first: 10) {
edges {
node {
id
title
sku
}
}
}
}
}
}
}
}
}
}
解决方法
弄清楚了。这仅仅是了解嵌套的问题。这是您使用GraphQL API在Shopify中获取产品和交付率的方式:
query {
deliveryProfiles (first: 2) {
edges {
node {
profileItems (first: 8) {
edges {
node {
product {
id
handle
}
variants (first: 8) {
edges {
node {
id
title
}
}
}
}
}
}
profileLocationGroups {
locationGroupZones(first: 2) {
edges {
node {
methodDefinitions(first: 2) {
edges {
node {
rateProvider {
... on DeliveryRateDefinition {
id
price {
amount
}
}
... on DeliveryParticipant {
id
fixedFee {
amount
currencyCode
}
percentageOfRateFee
participantServices {
active
name
}
}
}
}
}
}
}
}
}
}
}
}
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。