mage2kishan / module-disable-wishlist-compare
Disable Wishlist and Compare functionality across the entire Magento 2 frontend (works on Hyva and Luma).
Package info
github.com/mage2sk/module-disable-wishlist-compare
Type:magento2-module
pkg:composer/mage2kishan/module-disable-wishlist-compare
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0
- mage2kishan/module-core: ^1.0
- magento/framework: ^103.0
- magento/module-catalog: ^104.0
- magento/module-wishlist: ^101.0
README
Panth Disable Wishlist & Compare — Remove Wishlist and Compare from Magento 2 (Hyva + Luma)
Completely disable Magento 2's Wishlist and Compare features across the entire frontend — every button, link, sidebar, cart row action, customer-account tab, widget link, JS handler, and direct URL route. Works identically on Hyva and Luma. One module, admin toggles, no theme edits.
Many storefronts — single-SKU brands, B2B catalogs, industrial supply, jewellery, wholesale — never want Wishlist or Compare shown. Magento's built-in config flags only cover a handful of surfaces and leave behind broken links, empty sidebars, ghost JS handlers, and 302 redirects to a login page. Panth Disable Wishlist & Compare is a clean, comprehensive kill-switch.
Preview
Admin Configuration
Stores → Configuration → Panth Infotech → Disable Wishlist & Compare — four toggles, all default to Yes, applied immediately after cache flush.
Need Custom Magento 2 Development?
Kishan SavaliyaTop Rated Plus on Upwork |
Panth Infotech Agency |
Table of Contents
- What This Disables
- How It Works
- Compatibility
- Installation
- Admin Toggles
- Restoring the UI
- Troubleshooting
- Support
What This Disables
Wishlist
| Surface | Where | Mechanism |
|---|---|---|
| Header wishlist icon/link | Hyva + Luma | Layout remove + header template arg override |
| Wishlist sidebar block | Luma | Layout remove |
| Product detail page "Add to Wish List" | Hyva + Luma | Layout remove (view + related + upsell) |
| Category list add-to-wishlist buttons | Hyva + Luma | Layout remove (core + JS helper) |
| Cart row "Move to Wishlist" action | Hyva + Luma | Layout remove for all 7 product types |
| Customer-account side-nav tab | Hyva + Luma | Layout remove |
Luma widget wishlist link (new_grid, new_list, listing) |
Luma | Block plugin empties AbstractProduct::getAddToWishlistUrl() |
Magento helper Wishlist\Helper\Data::isAllow() |
All themes | DI plugin forces false |
Hyva ViewModel\Wishlist display methods |
Hyva | DI plugin forces false |
/wishlist/* direct URL access |
All themes | Predispatch observer → 404 before auth-redirect |
Compare
| Surface | Where | Mechanism |
|---|---|---|
| Hyva header compare icon | Hyva | Layout remove + show_compare=false arg override |
| Core compare header link / sidebar | Luma | Layout remove |
| Product detail page "Add to Compare" | Hyva + Luma | Layout remove (view + related + upsell) |
| Category list add-to-compare buttons | Hyva + Luma | Layout remove (core + JS helper) |
Luma widget compare link (new_grid, new_list, listing) |
Luma | Block plugin empties AbstractProduct::getAddToCompareUrl() |
Hyva ViewModel\ProductCompare display methods |
Hyva | DI plugin forces false |
/catalog/product_compare/* direct URL access |
All themes | Controller plugin on Compare::execute → 404 |
How It Works
The module combines six complementary mechanisms so every rendering path is covered no matter how a theme or widget decides to emit wishlist/compare markup.
- Layout XML removes on
default,catalog_product_view,catalog_category_view,catalog_list_item,catalogsearch_result_index,catalogsearch_advanced_result, andcheckout_cart_index— removes every named wishlist/compare block Magento core and Hyva declare. - Header-content argument override — Hyva's
header.phtmlgates the compare/wishlist icons onshow_compare/show_wishlistarguments of theheader-contentblock; both forced tofalse. - Helper plugin on
Magento\Wishlist\Helper\Data::isAllow()/isAllowInCart()— forces false so any third-party block that checks the helper drops out silently. - Block plugin on
Magento\Catalog\Block\Product\AbstractProduct::getAddToCompareUrl()/getAddToWishlistUrl()— returns empty string, which breaks theif ($block->getAddToCompareUrl())gate in every Luma widget template (new_grid.phtml,new_list.phtml,listing.phtml) without any template overrides. - Hyva ViewModel plugins on
Hyva\Theme\ViewModel\WishlistandHyva\Theme\ViewModel\ProductCompare—isEnabled,isAllowInCart,showInProductList,showOnProductPage,showCompareSidebarall forced to false. - Route blocking — predispatch event for
controller_action_predispatch_wishlist(runs before the customer-session auth redirect, so/wishlist/*returns an honest 404 instead of a 302 to login) plus a controller plugin onMagento\Catalog\Controller\Product\Compare::executeto 404 compare routes. AJAX / POST requests return a JSON stub so stale JS listeners fail quietly.
Compatibility
| Requirement | Supported |
|---|---|
| Magento Open Source | 2.4.4, 2.4.5, 2.4.6, 2.4.7, 2.4.8 |
| Adobe Commerce | 2.4.4 — 2.4.8 |
| PHP | 8.1, 8.2, 8.3, 8.4 |
| Hyva Theme | 1.0+ (fully compatible) |
| Luma Theme | Native support |
| Panth Core | ^1.0 (installed automatically) |
Installation
composer require mage2kishan/module-disable-wishlist-compare bin/magento module:enable Panth_Core Panth_DisableWishlistCompare bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:flush
Verify
bin/magento module:status Panth_DisableWishlistCompare
# Module is enabled
Check any page — header icons, PDP buttons, category add-to links, and cart row actions for wishlist/compare should all be gone. /wishlist/ and /catalog/product_compare/ should return 404.
Admin Toggles
Navigate to Stores → Configuration → Panth Infotech → Disable Wishlist & Compare. A direct link also appears under the Panth Infotech admin sidebar.
| Setting | Default | What it controls |
|---|---|---|
| Module Enabled | Yes | Master switch. If No, all runtime plugins (helper / ViewModel / controller) are disabled. |
| Disable Wishlist | Yes | Gates all wishlist-related runtime plugins + route blocking. |
| Disable Compare | Yes | Gates all compare-related runtime plugins + route blocking. |
| Block Direct URL Access | Yes | When Yes, /wishlist/* and /catalog/product_compare/* return 404. Set to No if you want the routes reachable without the UI. |
Note on layout removals: The layout XML removes are module-level — they apply whenever the module is enabled at the CLI. The admin toggles above only affect runtime plugins and route blocking. To restore the UI while keeping the module installed, disable it via CLI (see below).
Restoring the UI
Option A — keep the module, restore UI
bin/magento module:disable Panth_DisableWishlistCompare bin/magento cache:flush
Option B — uninstall entirely
bin/magento module:disable Panth_DisableWishlistCompare composer remove mage2kishan/module-disable-wishlist-compare bin/magento setup:upgrade bin/magento setup:di:compile bin/magento cache:flush
Troubleshooting
The compare icon still shows in the Hyva header
You probably hit the edge case where a child theme re-adds header-compare or passes its own show_compare="true" argument to header-content. Confirm by checking var/log/system.log for layout errors, and ensure your child theme's Magento_Theme/layout/default.xml doesn't re-declare show_compare.
/wishlist/ redirects to login (302) instead of 404
Flush the config cache — the predispatch observer reads the "Block Direct URL Access" flag at runtime:
bin/magento cache:flush config
A third-party module re-adds an "Add to Wish List" button
This module plugs every Magento-core integration point. If a third-party module renders its own wishlist button via a custom block, add <referenceBlock name="..." remove="true"/> for that block in a child override or raise an issue.
DI compile fails after composer require
Make sure Panth_Core, Magento_Wishlist, and Magento_Catalog are enabled — they are hard dependencies.
Support
- Issues: github.com/mage2sk/module-disable-wishlist-compare/issues
- Agency: Panth Infotech on Upwork
- Direct: kishansavaliya.com — Get a free quote
