mirror of
https://github.com/vercel/commerce.git
synced 2025-06-20 06:01:21 +00:00
Shuffle related products
This commit is contained in:
parent
5630c073c6
commit
17ee45307e
@ -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)) ?? [],
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user