【发布时间】:2021-11-20 01:02:09
【问题描述】:
我正在尝试使用 graphql 在批量操作中查询商店的订单。我在 graphql 请求中使用 tags 变量来查询带有特定标签的订单。为了做到这一点,我一直在关注 Shopify 的 documentation。
这是我一直在尝试的:
const variables = {
"tags": "tag:foo AND tag:bar"
};
const query = gql`
mutation getOrders($tags: String!) {
bulkOperationRunQuery(
query:"""
query {
orders(query: $tags) {
edges {
node {
id
email
}
}
}
}
"""
) {
bulkOperation {
id
url
status
}
userErrors {
field
message
}
}
}
`;
const bulkOperation = await graphQLClient.request(query, variables);
但是,我总是从 api 得到这个错误:
Variable $tags is declared by getOrders but not used
有谁知道是否有办法在批量操作中使用 graphql 变量?谢谢!
【问题讨论】:
标签: graphql shopify graphql-js shopify-app shopify-api