Skip to content

[Issue] Guard Magento_Catalog JavaScript from lack of minicart #34513

Closed
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #34185: Guard Magento_Catalog JavaScript from lack of minicart


Description

When the mini-cart is removed, or during the checkout, Magento_Catalog::js/product/storage/ids-storage-compare.js throws an error. The error is masked during checkout because there is a DOM element with id="checkout" which some browsers make available on window.checkout (so there's no error but the information assumed to be present isn't there).

This pull request changes the guard logic to protect against this error.

Edit: I found three more places where the lack of minicart causes errors. The minicart.js itself also suffers from this assumption, but I chose to not patch that here.

Related Pull Requests

None

Manual testing scenarios (*)

  1. Remove the mini cart via layout (<referenceBlock name="minicart" remove="true" />)
  2. Add an item to the 'compare' list
  3. Witness error on JavaScript console / lack of error after this change

Screenshot_2021-09-28_22-05-27

Questions or comments

None

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)

Metadata

Metadata

Assignees

Labels

Area: Cart & CheckoutComponent: CatalogFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions