Question

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?

Was it helpful?

Solution

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!!!

OTHER TIPS

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>

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>

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>

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>
<referenceBlock name="view.addto.wishlist" remove="true"/>
<referenceBlock name="view.addto.compare" remove="true"/>
<referenceBlock name="product.info.mailto" remove="true" />
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top