forked from crowetic/commerce
Fixes quirks with featured and related products. (#978)
This commit is contained in:
parent
7de3ae5583
commit
8ff670d7d6
@ -99,7 +99,7 @@ export default async function ProductPage({ params }: { params: { handle: string
|
||||
async function RelatedProducts({ id }: { id: string }) {
|
||||
const relatedProducts = await getProductRecommendations(id);
|
||||
|
||||
if (!relatedProducts) return null;
|
||||
if (!relatedProducts.length) return null;
|
||||
|
||||
return (
|
||||
<div className="px-4 py-8">
|
||||
|
@ -37,7 +37,7 @@ function ThreeItemGridItem({
|
||||
|
||||
export async function ThreeItemGrid() {
|
||||
// Collections that start with `hidden-*` are hidden from the search page.
|
||||
const homepageItems = await getCollectionProducts('hidden-homepage-featured-items', 3);
|
||||
const homepageItems = await getCollectionProducts('hidden-homepage-featured-items');
|
||||
|
||||
if (!homepageItems[0] || !homepageItems[1] || !homepageItems[2]) return null;
|
||||
|
||||
|
@ -36,9 +36,9 @@ export const getCollectionsQuery = /* GraphQL */ `
|
||||
`;
|
||||
|
||||
export const getCollectionProductsQuery = /* GraphQL */ `
|
||||
query getCollectionProducts($handle: String!, $first: Int = 100) {
|
||||
query getCollectionProducts($handle: String!) {
|
||||
collection(handle: $handle) {
|
||||
products(first: $first) {
|
||||
products(first: 100) {
|
||||
edges {
|
||||
node {
|
||||
...product
|
||||
|
@ -199,7 +199,6 @@ export type ShopifyCollectionProductsOperation = {
|
||||
};
|
||||
variables: {
|
||||
handle: string;
|
||||
first?: number;
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user