0

Currently, Our compare product print page showing the footer section on that.

I want to remove the footer link in compare product print page.

How to do that.

Thanks.

0

The Compare Products Page footer link is getting rendered from the below layout XML file. Copy the below file from the vendor path to your current theme.

vendor/magento/module-catalog/view/frontend/layout/catalog_product_compare_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="page.main.title">
        <action method="setPageTitle">
            <argument translate="true" name="page_title" xsi:type="string">Compare Products</argument>
        </action>
    </referenceBlock>
    <referenceContainer name="content">
        <block class="Magento\Catalog\Block\Product\Compare\ListCompare" name="catalog.compare.list" template="Magento_Catalog::product/compare/list.phtml" cacheable="false"/>
    </referenceContainer>
</body>
</page>

Add the below lines to remove the footer section

    <referenceContainer name="footer-container" remove="true"/>
    <referenceBlock name="copyright" remove="true" />

The Final Version should look like this

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="page.main.title">
        <action method="setPageTitle">
            <argument translate="true" name="page_title" xsi:type="string">Compare Products</argument>
        </action>
    </referenceBlock>
    <referenceContainer name="content">
        <block class="Magento\Catalog\Block\Product\Compare\ListCompare" name="catalog.compare.list" template="Magento_Catalog::product/compare/list.phtml" cacheable="false"/>
    </referenceContainer>
    <referenceContainer name="footer-container" remove="true"/>
    <referenceBlock name="copyright" remove="true" />
</body>
</page>

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.