Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion functions/vtexLegacyRelatedProductsLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export interface Props {
* @description: number of related products
*/
count?: number;
/**
* @description remove unavailable items from result
*/
hideUnavailableItems?: boolean;
}

/**
Expand All @@ -30,13 +34,14 @@ const loaderV0: LoaderFunction<
> = async (
req,
ctx,
{ crossSelling, count },
{ crossSelling, count, hideUnavailableItems },
) => {
const data = await loader(
{
slug: ctx.params.slug,
crossSelling,
count,
hideUnavailableItems,
},
req,
ctx.state,
Expand Down
2 changes: 1 addition & 1 deletion packs/vtex/loaders/legacy/relatedProductsLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async function loader(
const productId = await getProductGroupID(props);

if (!productId) {
throw new Error("Missing props. Please fill: slug or id");
return null;
}

const vtexRelatedProducts = await fetchAPI<LegacyProduct[]>(
Expand Down