Skip to content

Remove Magento_Catalog's hard dependency on Magento_Wishlist - #396

Draft
pingiun wants to merge 2 commits into
mage-os:mainfrom
cresset-tools:catalog-wishlist-seam
Draft

pingiun wants to merge 2 commits into
mage-os:mainfrom
cresset-tools:catalog-wishlist-seam

Conversation

@pingiun

@pingiun pingiun commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Description (*)

Catalog\Block\Product\Context and Catalog\Helper\Product\Compare take Wishlist\Helper\Data as a typed constructor argument, and five Catalog/CatalogWidget templates call that helper. Without Wishlist, setup:di:compile fails. Part of the series that makes Magento_Wishlist removable (#286, #287).

  • Add Catalog\Helper\Wishlist\AddToWishlistInterface (isAllow(), getAddParams()). Catalog binds it to a null implementation.
  • Wishlist\Helper\Data implements the interface and Wishlist binds the interface to it, so callers still get the wish list helper itself.
  • Templates use $block->isAddToWishlistAllowed() (new on AbstractProduct) and getAddToWishlistParams().
  • Drop the require from Catalog's and CatalogWidget's composer.json.

Related Pull Requests

#395, #397, #398, #399, #400 (which builds on this one)

Manual testing scenarios (*)

  1. "Add to Wish List" works as before on the compare page and in the product widgets. It's hidden when the wish list is disabled.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

🤖 Generated with Claude Code

Catalog\Block\Product\Context and Catalog\Helper\Product\Compare took
Magento\Wishlist\Helper\Data as a typed constructor argument, and five
Catalog and CatalogWidget templates called that helper directly. Without
module-wishlist, setup:di:compile fails for Magento_Catalog.

Add Magento\Catalog\Helper\Wishlist\AddToWishlistInterface with the two
methods Catalog uses (isAllow() and getAddParams()). Catalog binds it to
NullAddToWishlist. Wishlist\Helper\Data implements it and Magento_Wishlist
binds the interface to that helper, so with Wishlist installed
Context::getWishlistHelper() still returns the wishlist helper itself. Code
relying on its other methods keeps working.

The templates now call $block->isAddToWishlistAllowed(), a new
AbstractProduct method, and $block->getAddToWishlistParams(). The legacy
product/listing.phtml now also checks isAddToWishlistAllowed() before
rendering its "Add to Wish List" link, like the other templates.

Catalog's and CatalogWidget's composer.json drop magento/module-wishlist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant