1

I have a 3rd Party theme (Ves-Fasony) installed and I need to remove the following in Product Page:

  • Breadcrumps
  • Review
  • Add to Wish List
  • Add to Compare
  • Email

enter image description here

I removed the 「Add to Wish List」and「Review」by disabling it in Admin Panel.But I am not sure about others, I tried to remove the breadcrumps by doing the following:

  1. I created a layout folder under the following directory

    [magento_dir]/app/design/frontend/[vendor_name]/[theme_name]/

  2. Then under layout folder, I created default.xml which has the following code

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    /**
     * Copyright © 2016 Magento. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    
        <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="page.top" remove="true" />
    </body>
    

I am certainly wrong because it is not working. I am a newbie and I am really having a hard time understanding Magento. Please tell me where I went wrong and what should I do to remove those.

0

I don't think there are an "absolutely correct way" on removing the elements on pages. Even using CSS display:none to hide the elements is also a good way.

OK let's back to XML way, just make sure:

  1. On correct path. In your case, [magento_dir]/app/design/frontend/[vendor_name]/[theme_name]/Magento_Catalog/layout/catalog_product_view.xml
  2. Refer to correct block. In your case:

Remove Breadcrumbs

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

Remove Review

<referenceBlock name="product.info.review" remove="true" />
<referenceBlock name="reviews.tab" remove="true"/>

Remove Add to Wish List+Add to Compare+Email

Actually they're in the same container so we can remove it within a line:

<referenceContainer name="product.info.social" remove="true" />

Tested on Magento 2.1.7 EE. If you find the block/container cannot remove, most likely you have other modules/themes to override your codes. If that happens, you've to modify the block name accordingly.

  • Thank you! It worked and you explained it well. Before I was trying to remove the Email and Add to Compare by the following code '<referenceBlock name="view.addto.compare" remove="true" /> <referenceBlock name="product.info.mailto" remove="true" />' but it didn't work. Yours work well. I wonder if you can also teach me how to remove the compare button in the product list. I tried to remove it inside the <custom_module_dir>/Magento_Catalog/templates/product/listing.phtml but it didn't work too. – Dean Jul 11 '17 at 6:12
  • On [magento_dir]/app/design/frontend/[vendor_name]/[theme_name]/Magento_Catalog/layout/catalog_category_view.xml, add <referenceBlock name="compare" remove="true" /> – PY Yick Jul 11 '17 at 7:22

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.