Magento 2 – How to Remove Minicart from Sticky Header

knockoutjsmagento2requirejs

In my project minicart comes under both header & sticky header. But I want to remove it from sticky header. Is there any setting from backend or which file I need to edit to hide checkout from sticky header. Please help.

Best Answer

If you are Using Custom Theme Check your header block, there should be a block named as mini_cart(block-name could be change according to your theme) , I wonder your sticky header is rending to the header block.

If you want to remove minicart from complete header you could use Magento XML to remover blocks from layouts.

<referenceBlock name="block_name" remove="true"/>

Example:

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <body>
        <referenceBlock name="block_name" remove="true"/>
    </body>
</page>

Even Magento2 Provides us the way to disable Minicart popup through admin panel, To disable, go to Stores > Configuration > Sales > Checkout > Shopping Cart Sidebar and change "Display Shopping Cart Sidebar" to No.

Or Else You want to Disable Minicart only on Sticky Header You can do so with Css:

Checkout the class Sticky header is adding to parent class after a slight scroll, It should be .active or .opened or anything like that.

just add the css in your custom style sheet

.parentClass.active{
     display:none;
}

Hope this will help.

Related Topic