Issue
How to shuffle products on category page when you refresh the page in magento2?
Solution
Hello Mahendra try this solution!!
First Override your list.phtml file in your custom theme. Add this code in your list.phtml file.
$productArray = iterator_to_array($_productCollection); shuffle($productArray);
and add this $productArray in foreach loop.
cacheable="false" in your catalog_category_view.xml file.
<block class="Magento\Catalog\Block\Product\ListProduct" name="category.products.list" as="product_list" template="Magento_Catalog::product/list.phtml" cacheable="false">
Answered By - Shailraj Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.