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>
2
  • which version of magento 2 are you using ?
    – liyakat
    Aug 21, 2017 at 5:49
  • 2.1.7 Enterprise
    – Zinat
    Aug 21, 2017 at 5:51

2 Answers 2

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
2
  • 1
    works like a charms, thank you. Jul 1, 2019 at 6:31
  • @ZeeshanKhuwaja Thanks Jul 1, 2019 at 7:05
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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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