我正在使用 Gatsby + GraphQL + Shopify。我在过去 10 天内检索我的订单时遇到问题。
我的查询如下所示:
query {
customer(customerAccessToken: "${customerAccessToken}") {
orders(last: 10) {...}
}
}
它返回这个:"message": "using last without before is not supported"
我注意到这个问题发生在其他一些开发人员身上:https://community.shopify.com/c/Shopify-Discussion/How-to-get-customer-s-orders-and-sort-by-date-in-descending/m-p/629133/highlight/false#M151241
如果您查看文档,它没有说明使用
before
与 last
:https://shopify.dev/docs/admin-api/graphql/reference/object/order?api[version]=2020-07
底部有一个游乐场,您可以在其中测试查询。
其他人以前见过这个问题吗?
最佳答案
在操场上玩了一会儿之后……您可以使用 解决方法 - reverse
和 first
{
orders(first: 10, reverse:true) {
edges {
node {
id
createdAt
}
}
}
}
关于javascript - Graphql错误: "using last without before is not supported",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62765178/