Shuffle related products

This commit is contained in:
cond0r 2021-06-10 16:20:10 +03:00
parent 5630c073c6
commit 17ee45307e

View File

@ -65,8 +65,9 @@ export default function getRelatedProductsOperation({
return {
products:
data.productRecommendations
?.map((product) => normalizeProduct(product as ShopifyProduct))
.splice(0, variables?.first || 4) ?? [],
?.sort(() => 0.5 - Math.random())
.splice(0, variables?.first || 4)
.map((product) => normalizeProduct(product as ShopifyProduct)) ?? [],
}
}