graphql - GraphQL 按标签和价格范围过滤产品
问题描述
我正在使用shopify-buy SDK 和 fetchQuery 函数发出以下有效负载:
first: 50
query: "tags:[new] AND priceRange:{minVariantPrice:0 AND maxVariantPrice:40}"
reverse: false
sortKey: "PRICE"
这将返回所有产品,据我所知,标签过滤器也不起作用。我在哪里错了?这是发出的命令:
fragment ProductFragment on Product {
id
availableForSale
createdAt
updatedAt
descriptionHtml
description
handle
productType
title
vendor
publishedAt
onlineStoreUrl
options {
id
name
values
}
images(first: 250) {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
cursor
node {
id
src
altText
}
}
}
variants(first: 250) {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
cursor
node {
...VariantFragment
}
}
}
}
fragment VariantFragment on ProductVariant {
id
title
price
priceV2 {
amount
currencyCode
}
presentmentPrices(first: 20) {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
price {
amount
currencyCode
}
compareAtPrice {
amount
currencyCode
}
}
}
}
weight
available: availableForSale
sku
compareAtPrice
compareAtPriceV2 {
amount
currencyCode
}
image {
id
src: originalSrc
altText
}
selectedOptions {
name
value
}
unitPrice {
amount
currencyCode
}
unitPriceMeasurement {
measuredType
quantityUnit
quantityValue
referenceUnit
referenceValue
}
}
query ($first: Int!, $query: String, $sortKey: ProductSortKeys, $reverse: Boolean) {
products(first: $first, query: $query, sortKey: $sortKey, reverse: $reverse, after: "eyJsYXN0X2lkIjoxNTQzODk0MjM3MjM5LCJsYXN0X3ZhbHVlIjoiMTU0Mzg5NDIzNzIzOSJ9") {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
cursor
node {
...ProductFragment
}
}
}
}
解决方案
推荐阅读
- javascript - 来自 ng-repeat 的数组数据在多列和多行中,我该怎么做?
- android - 如何制作自定义 SMS 权限对话框
- xml - 如何将声明的字段分配给记录 XML
- javascript - 如何在firebase中使用javascript循环为多个用户注册和设置子数据?
- c - 为什么用更大的字符减去较小的字符会给出一个大的正整数而不是一个负整数?
- typescript - 类型错误:通用类型不可分配
- c# - WinForm CefSharp
- google-app-maker - 无法预设绑定到空值的单选按钮
- javascript - 使用 React 转换组为表格中的行进出动画
- python - 具有极不平衡类的自定义交叉验证和验证