When I disable module Magento_Wishlist in admin (Stores->configuration->advanced->advanced) I get the following error in frontend (js console):

Uncaught Error: Script error for: addToWishlist

I cannot disable the module from CLI because of its dependencies. What can I do to get rid off the error?

I already cleaned cache, did setup:upgrade and setup:static-content:deploy


php bin/magento module:disable -f Magento_Wishlist to disable a module on which other modules rely on.

It has to be done first in test environment so that any break in functionality is noticed. If your stuff breaks then the only solution is to remove the blocks in xml or phtml.


I have same issue may be its default issue, I have solved using xml file, You have to enable wishlist module and go to your theme default.xml file and add <referenceBlock name="wishlist_sidebar" remove="true" />

Go to theme,


comment below code manually,

<div class="product-addto-links" data-role="add-to-links">
    <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?>
        <a href="#"
            class="action towishlist"
            data-post='<?php /* @escapeNotVerified */ echo $_wishlistSubmitParams; ?>'
            data-action="add-to-wishlist"><span><?php /* @escapeNotVerified */ echo __('Add to Wish List') ?></span></a>
    <?php endif; ?>
    <a href="#" data-post='<?php /* @escapeNotVerified */ echo $compareHelper->getPostDataParams($_product);?>'
        class="action tocompare"><span><?php /* @escapeNotVerified */ echo __('Add to Compare') ?></span></a>

Your error are gone now.

  • That would work, but I'm looking for a solution to disable and enable that module without commenting code - to be able to do it in the future just running a cli command or changing config in admin – Tom Mar 1 '16 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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