Re-use filter for live products only

This commit is contained in:
Samantha Kellow
2023-09-15 19:51:56 +01:00
parent 88228a8dc2
commit da4216f6f3
4 changed files with 21 additions and 8 deletions

View File

@@ -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>