mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 21:51:21 +00:00
saleor: integrate collections
This commit is contained in:
parent
9ca6c38755
commit
f5ec8e17a4
@ -45,7 +45,7 @@ export const handler: SWRHook<
|
||||
let edges
|
||||
|
||||
if (categoryId) {
|
||||
edges = data.node?.products?.edges ?? []
|
||||
edges = data.collection?.products?.edges ?? []
|
||||
// FIXME @zaiste, no `vendor` in Saleor
|
||||
// if (brandId) {
|
||||
// edges = edges.filter(
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { SaleorConfig } from '../api'
|
||||
import { Collection, CollectionCountableEdge } from '../schema'
|
||||
import { CollectionCountableEdge } from '../schema'
|
||||
import { getSiteCollectionsQuery } from './queries/'
|
||||
|
||||
export type Category = {
|
||||
|
@ -3,21 +3,15 @@ import { productConnection } from './get-all-products-query'
|
||||
export const getCollectionProductsQuery = /* GraphQL */ `
|
||||
query getProductsFromCollection(
|
||||
$categoryId: ID!
|
||||
$first: Int = 250
|
||||
$sortKey: ProductCollectionSortKeys = RELEVANCE
|
||||
$reverse: Boolean = false
|
||||
$first: Int = 100
|
||||
$channel: String = "default-channel"
|
||||
) {
|
||||
node(id: $categoryId) {
|
||||
collection(id: $categoryId, channel: $channel) {
|
||||
id
|
||||
... on Collection {
|
||||
products(
|
||||
first: $first
|
||||
sortKey: $sortKey
|
||||
reverse: $reverse
|
||||
) {
|
||||
${productConnection}
|
||||
}
|
||||
products(first: $first) {
|
||||
...productConnection
|
||||
}
|
||||
}
|
||||
}
|
||||
${productConnection}
|
||||
`
|
||||
|
Loading…
x
Reference in New Issue
Block a user