71 votes
Accepted

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

In Magento 2, you can actually now remove Compare products functionality via xml file. Compare products block is defined in vendor/magento/module-catalog/view/frontend/layout/default.xml and you can ...
Kai's user avatar
  • 826
44 votes

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

I grepped the source for all compare blocks. For 2.3 this is the complete list. This will also remove the compare link from the header. <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
Michael Thessel's user avatar
40 votes

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

You can add following xml instruction to either your custom theme's default xml file which should be located at /app/design/frontend/Vendor/theme/Magento_Theme/layout/default.xml or to Magento_Catalog/...
Devtype's user avatar
  • 3,008
18 votes
Accepted

How render product wishlist link functionality in custom template (phtml) in magento 2

You can try something like the following code: <a href="#" data-post='<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) ?>' class="action towishlist" ...
Krishna ijjada's user avatar
14 votes
Accepted

How to add programmatically product to wishlist in Magento 2?

To do so, you will first have to inject the following in your constructor: Magento\Wishlist\Model\WishlistFactory Magento\Catalog\Api\ProductRepositoryInterface So update your class constructor like ...
Raphael at Digital Pianism's user avatar
13 votes

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

Wishlist can be disabled from store > Configurations > Customers > Wish List> General options> Enabled: No.
Shachi's user avatar
  • 131
11 votes
Accepted

Remove product from wishlist using customer id and product id in Magento2?

Unfortunately Magento didn't provide ready to use function to delete item from wishlist. But you can use follow code to do this, I tested it and all works fine at my local Magento. protected $...
Amasty's user avatar
  • 6,508
9 votes
Accepted

setup:upgrade SQL error after update from 2.2.8 to 2.3.1

Apparently it is a Magento bug. When comparing current schema to declared schema, constraints and other indexes are handled separately, but the existing index is not dropped before the new UNIQUE ...
Fabian Schmengler's user avatar
8 votes

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

Disable Wishlist on Stores > Configuration > Customers > Wishlist and to disable the Compare function paste this lines below on Magento_Catalog/layout/default.xml of your theme. <?xml version="1.0"...
Rafael Corrêa Gomes's user avatar
8 votes
Accepted

Magento 2 - Keep Wishlist items

In app/code/Magento/Wishlist/Controller/Index/Cart.php in the execute() method the following code is what adds the item to the cart and removes it from the wishlist: $item->addToCart($this->cart,...
Raphael at Digital Pianism's user avatar
8 votes
Accepted

create mini wish list icon like mini cart

You can either create a module or customize the code in the theme, I have used custom module as follows, app/code/VendorName/ModuleName/registration.php <?php \Magento\Framework\Component\...
Haritha's user avatar
  • 666
7 votes

Magento 2 - How to disable wishlist and product review module

As highlighted in a previous comment, disabling the module is not a good method as others may depend on it, this has been enforced in Magento 2.2.0 when trying to run the below commans: php bin/...
Dan Norris's user avatar
7 votes

Check if product is in wishlist

Another approach in order to retrieve wishlist or custumer related information, is to use localStorage combined with Ajax request if the localstorage is empty. Check information in your console : ...
Franck Garnier's user avatar
7 votes
Accepted

Load additional product attributes in Wishlist

Where are the products loaded? The products are loaded in the "_afterLoad" method of the items collection. A product collection is instantiated there based on the product ids of all items and ...
Fabian Schmengler's user avatar
7 votes
Accepted

How to get the wishlist collection of a customer by Customer Id in magento2

Try this private $wishlist; public function __construct( ... \Magento\Wishlist\Model\Wishlist $wishlist ) { $this->wishlist = $wishlist; ... } ... $customer_id = 1; $...
Dinesh Yadav's user avatar
  • 6,447
7 votes
Accepted

How get wishlist in Magento 2 Rest API?

Create a module Test_Mobileshop Please follow the below steps with the file paths 2.app/code/Test/Mobileshop/etc/webapi.xml <?xml version="1.0" ?> <routes xmlns:xsi="http://...
Nagaraju Kasa's user avatar
6 votes
Accepted

Magento 2.3.2: Uncaught Error: Call to a member function setUseContainer() on boolean

I think i should add another answer and leave previous answer as it is for knowledge purpose. I realized that i'm missing something. a very simple way to resolve this issue. i have two overridden ...
Partab Saifuddin Zakir's user avatar
5 votes

Returning wishlist item collection for currently logged in user

To do so you need to use the Magento\Wishlist\Controller\WishlistProviderInterface interface. Inject this class in your constructor: protected $wishlistProvider; public function __construct( ......
Raphael at Digital Pianism's user avatar
5 votes
Accepted

Removing wishlist link - top header magento 2

app/design/frontend/vendorName/themeName/Magento_Wishlist/layout/default.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="...
WaPoNe's user avatar
  • 1,590
5 votes

how to remove text "items" from top links wishlist magento 2

You can override the phtml: Theme_Root/Magento_Wishlist/templates/link.phtml Instead this: <span data-bind="text: wishlist().counter" class="counter qty"></span> You can do this: <...
David Motilla's user avatar
5 votes
Accepted

Wishlist button color on Magento 2.1

Copy the following file: /vendor/magento/module-wishlist/view/frontend/templates/catalog/product/view/addto/wishlist.phtml to you desired theme like below: /app/design/frontend/Dapl/demo/...
Sukumar Gorai's user avatar
5 votes
Accepted

How to update/trigger wishlist counter in Magento 2.3?

Update your js file as require([ .... 'Magento_Customer/js/customer-data' ], function (...,customerData) { "use strict"; ... var sections = ['wishlist']; customerData.invalidate(...
Nisith's user avatar
  • 300
5 votes

Magento 2 - Don't want to remove wishlist items when click 'Add all to cart' button

Magento adds wishlist items to the cart using the addToCart() method on the wishlist Item class. This method has a parameter that specifies whether to also remove the item from the wishlist. You can ...
Scott Buchanan's user avatar
4 votes

Magento2 rewrite _prepareCollection method in wishlist returning blank page

Worked like a charm. Was trying to add a function for delete all wishlist by extending \Magento\Wishlist\Block\Customer\Wishlist but wasn't giving the desired output, but after adding the constructor ...
Umar Yousaf's user avatar
4 votes

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

For Magento 2.1.x Adding a default.xml file to your theme in: /Magento_Catalog/layout/default.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Goldy's user avatar
  • 1,013
4 votes
Accepted

Magento2 - How to remove item from wishlist?

You first need to inject several classes in your constructor protected $_wishlistProviderInterface; protected $_itemFactory; public __construct( ... \Magento\Wishlist\Controller\...
Raphael at Digital Pianism's user avatar
4 votes

“Add to wishlist” without redirecting to wishlist page Magento 2.06

To fix it we need to override Magento\Wishlist\Controller\Index\Add controller. – add following line in module di.xml to tell magento to use our class instead of standard one. Filename: Vendor/Module/...
Sergey Korzhov's user avatar
4 votes

“Add to wishlist” without redirecting to wishlist page Magento 2.06

Another solution would be to add Plugin. Add di.xml in etc directory <type name="Magento\Wishlist\Controller\Index\Add"> <plugin name="custom_wishlist_redirect" type=&...
Amit Singh's user avatar
  • 1,765
4 votes

Magento 2 add to wish list event?

wishlist_add_product give us 3 parameters $this->_eventManager->dispatch( 'wishlist_add_product', ['wishlist' => $wishlist, 'product' => $product, 'item' =>...
Amit Bera's user avatar
  • 77.5k
4 votes
Accepted

How should i get the count of products in wishlist?

Wishlist item count is also stored in customer session. $count = Mage::getSingleton('customer/session')->getWishlistItemCount(); For not logged in customers it's 0, so it's same as ... $count = ...
sv3n's user avatar
  • 11.7k

Only top scored, non community-wiki answers of a minimum length are eligible