0

To limit the number of product displaying in minicart, I wrote in

app/design/frontend/myVendor/myTheme/Magento_Checkout/layout/default.xml

below but I see no effect!

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
            <reference name="minicart">
                <action method="setItemCount"><count>3</count></action>
            </reference>
    </body>
</page>
  • which version of magento 2 are you using ? – liyakat Aug 21 '17 at 5:49
  • 2.1.7 Enterprise – Zinat Aug 21 '17 at 5:51
4

You can also set limit the number of product displaying in mini cart using below steps.

  1. Login to your magento admin panel

  2. Set store configuration Maximum Display Recently Added Item(s) to `3

    (Located under Sales > Checkout > Shopping Cart Sidebar)

  3. Clear caches
0
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
            <referenceBlock name="minicart">
                <action method="setItemCount"><count>3</count></action>
            </referenceBlock>
    </body>
</page>

You have to get referenceBlock instead of reference node.

  • Still diesplys more than 3 :(, do I need to deploy again? – Zinat Aug 21 '17 at 5:59
  • which code have you written in phtml file? – Rakesh Jesadiya Aug 21 '17 at 6:00
  • the code is the magento default one – Zinat Aug 21 '17 at 6:02
  • Have u tried above? do you get it working? – Zinat Aug 21 '17 at 7:14
  • i havent try i have just give you referene for your xml use referenceBlock – Rakesh Jesadiya Aug 21 '17 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.