Magento 2 : Add to Wishlist not Appearing on Product Page
-
06-10-2020 - |
Pergunta
When the store is using custom child theme
design, add to wishlist
is not appearing on the product page.
When I switch to other theme, it appears.
What could be the reason?
UPDATE:
I realised that when I have catalog_product_view.xml under my custom theme in Magento_Catalog/layout, add to wishlist
is not appearing.
Solução
You Just needed to copy
module_wishlist/view/frontend/layout/catalog_product_view.xml
to
Magento_Wishlist/layout/catalog_product_view.xml
Under custom theme.
Outras dicas
I had similar problem in Magento 2.3.0. In my custom theme I changed layout of catalog_product_view.xml and "Add To Wishlist" stopped showing up. Any change to the file and it wouldn't be visible. So I called it manually:
<block class="Magento\Wishlist\Block\Catalog\Product\View\AddTo\Wishlist" name="wishlist" as="wishlist" template="Magento_Wishlist::catalog/product/view/addto/wishlist.phtml"/>
Add it anywhere in the code but this will work only in "Product Details". If you want to show it in product listing use following:
<block class="Magento\Wishlist\Block\Catalog\Product\ProductList\Item\AddTo\Wishlist" name="wishlist" as="wishlist" template="Magento_Wishlist::catalog/product/list/addto/wishlist.phtml"/>
I didn't checked if this works properly in product listing but it should.