mirror of
https://github.com/vercel/commerce.git
synced 2025-07-27 04:01:23 +00:00
Shopify Provier Updates (#212)
* changes * Adding shopify commit * Changed to query page by id * Fixed page query, Changed use-search GraphQl query * Update use-search.tsx * remove unused util * Changed cookie expiration * Update tsconfig.json Co-authored-by: okbel <curciobel@gmail.com>
This commit is contained in:
@@ -2,9 +2,9 @@ import getSortVariables from './get-sort-variables'
|
||||
import type { SearchProductsInput } from '../product/use-search'
|
||||
|
||||
export const getSearchVariables = ({
|
||||
categoryId,
|
||||
brandId,
|
||||
search,
|
||||
categoryId,
|
||||
sort,
|
||||
}: SearchProductsInput) => {
|
||||
let query = ''
|
||||
@@ -13,17 +13,14 @@ export const getSearchVariables = ({
|
||||
query += `product_type:${search} OR title:${search} OR tag:${search}`
|
||||
}
|
||||
|
||||
if (categoryId) {
|
||||
query += `tag:${categoryId}`
|
||||
}
|
||||
|
||||
if (brandId) {
|
||||
query += `${categoryId ? ' AND ' : ''}vendor:${brandId}`
|
||||
query += `${search ? ' AND ' : ''}vendor:${brandId}`
|
||||
}
|
||||
|
||||
return {
|
||||
categoryId,
|
||||
query,
|
||||
...getSortVariables(sort),
|
||||
...getSortVariables(sort, !!categoryId),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user