1

I want to remove add to wishlist and email in product detail page. How to do that?

enter image description here

Can anyone please point me on how to achieve this?

14
  • Do you want to remove the wishlist and send email to friend functionality from your website or only from the product details page?
    – Sumit
    Commented Sep 18, 2019 at 5:37
  • I want to do it only on product detail page
    – MagentoDev
    Commented Sep 18, 2019 at 6:02
  • Are you using any custom theme on your website?
    – Sumit
    Commented Sep 18, 2019 at 6:20
  • No, we have extended the luma theme
    – MagentoDev
    Commented Sep 18, 2019 at 6:32
  • OK, do you've calalog_product_view.xml in Magento_Catalog/layout folder in your theme?
    – Sumit
    Commented Sep 18, 2019 at 6:33

6 Answers 6

4

You can remove the wishlist and share in email with adding below code in your /Magento_Catalog/layout/catalog_product_view.xml file before the body tag end.

<referenceBlock name="view.addto.wishlist" remove="true"/>
<referenceBlock name="product.info.mailto" remove="true" />

Also, if you want to remove them with CSS then you can use below code in your CSS file.

.catalog-product-view .product-addto-links .action.towishlist,
.catalog-product-view .product-social-links .action.mailto.friend{
    display: none;
}

If you want to remove the send email to friend and wishlist feature throughout the website, then you can do that by setting configuration in the Magento admin.

For wishlist:

  1. Go to the Admin sidebar, click on “Stores” and then select “Configuration” under “Settings”.
  2. After the selection of “Configuration”, you need to choose “Wish List” under “Customers”.
  3. Then explore the General Options section and change “Enabled” to “No”.

For sending an email to a friend:

  1. Go to the Admin sidebar, click on “Stores” and then select “Configuration” under “Settings”.
  2. After the selection of “Configuration”, you need to choose “Email to a Friend” under “Catalog”.
  3. Set Enabled to No.

Hope it helps!!!

1
  • 1
    Thanks so much!
    – MagentoDev
    Commented Sep 18, 2019 at 7:07
0

To Remove Wishlist And Email in Detail Page

In Your Theme Create catalog_product_view.xml file Under the app/design/frontend/Vendorname/ThemeName/Magento_Catalog/layout/catalog_product_view.xml

Add This :-

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="view.addto.wishlist" remove="true"/>
        <referenceBlock name="product.info.mailto" remove="true" />
    </body>
</page>
1
  • I have tried this but still both the wishlist and email is displaying in detail page. I have tried clean cache, indexing.
    – MagentoDev
    Commented Sep 17, 2019 at 9:06
0

On your custom Theme: Make a Folder: Magento_Catalog/layout Inside there you make a file called catalog_product_view.xml

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

    <body>
<referenceBlock name="product.info.mailto" remove="true"/>
<referenceBlock name="view.addto.wishlist" remove="true"/>
    </body>
</page>
0

create a file

Vendor\Module\view\frontend\layout\catalog_product_view.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="view.addto.wishlist" remove="true" /> 
    </body>
</page>
0

In Magento 2, you can actually now remove Wishlist and Email products functionality via XML file. Wishlist and Email products block is defined in vendor/magento/module-catalog/view/frontend/layout/default.xml

and you can remove it by adding a default.xml file to your theme in: <theme_dir>/Magento_Catalog/layout/calalog_product_view.xml

inside which you remove your block as follows:

Add This :-

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="view.addto.wishlist" remove="true"/>
        <referenceBlock name="product.info.mailto" remove="true" />
    </body>
</page>
0
<referenceBlock name="view.addto.wishlist" remove="true"/>
<referenceBlock name="view.addto.compare" remove="true"/>
<referenceBlock name="product.info.mailto" remove="true" />

Your Answer

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

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