mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Re-use filter for live products only
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { getCollection, getCollectionProducts } from 'lib/shopify';
|
||||
import { getCollection } from 'lib/shopify';
|
||||
import { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
import Grid from 'components/grid';
|
||||
import ProductGridItems from 'components/layout/product-grid-items';
|
||||
import { defaultSort, sorting } from 'lib/constants';
|
||||
import { getLiveCollectionProducts } from 'lib/utils';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
@@ -33,7 +34,7 @@ export default async function CategoryPage({
|
||||
}) {
|
||||
const { sort } = searchParams as { [key: string]: string };
|
||||
const { sortKey, reverse } = sorting.find((item) => item.slug === sort) || defaultSort;
|
||||
const products = await getCollectionProducts({ collection: params.collection, sortKey, reverse });
|
||||
const products = await getLiveCollectionProducts({ collection: params.collection, sortKey, reverse });
|
||||
|
||||
return (
|
||||
<section>
|
||||
|
Reference in New Issue
Block a user