2
<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">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Module::catalog/product/view/addto/wishlist.phtml</argument>
            </action>
   </referenceBlock>
    </body>
</page>

I have creae same folder structure but file is not override.I have also tried with the block name "product.info.addto" but not changes.

6
  • Are you overriding the template using your theme or by using a custom module Oct 13, 2020 at 8:52
  • your query solved? Oct 13, 2020 at 9:44
  • @DavaGordon using module
    – Tanmay
    Oct 13, 2020 at 9:47
  • @RohanHapani no its not working
    – Tanmay
    Oct 13, 2020 at 9:47
  • You want to override in theme or module? Oct 13, 2020 at 9:48

2 Answers 2

1

Try This Way

app/code/Vendorename/Modulename/view/frontend/layout

catalog_category_view.xml

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
                <arguments>
                    <argument name="triggers" xsi:type="array">
                        <item name="addToWishlistLink" xsi:type="string">.action.towishlist</item>
                    </argument>
                </arguments>
            </block>
            <referenceBlock name="category.product.addto">
                <block class="Vendorename\Modulename\Block\Catalog\Product\ProductList\Item\AddTo\Wishlist"
                       name="category.product.addto.wishlist" as="wishlist" before="compare"
                       template="Vendorename_Modulename::catalog/product/list/addto/wishlist.phtml"/>
            </referenceBlock>
            <referenceContainer name="category.product.list.additional">
                <block class="Magento\Wishlist\Block\AddToWishlist" name="category.product.list.additional.wishlist_addto" template="Magento_Wishlist::addto.phtml" />
            </referenceContainer>
        </referenceContainer>
    </body>
</page>
1

Create the wishlist.phtml file in your module, path:app/code/{VendorName}/{PackageName}/view/frontend/templates/catalog/product/view/addto

copy the clone of template from wishlist module’s wishlist.phtml file and do your customization.

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.