Skip to content

[Issue] Fix swatch-renderer.js #39925

Open
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #39924: Fix swatch-renderer.js


Fix for "Uncaught TypeError: salableProducts is undefined" when no variant is available

Description (*)

This code fixes an error, when a configurable product has no available variant.

This is the JS error in the browser console:

Uncaught TypeError: salableProducts is undefined        swatch-renderer.js:514:29
    disableSwatchForOutOfStockProducts Magento_Swatches/js/swatch-renderer.js:514
    jQuery 2
    disableSwatchForOutOfStockProducts Magento_Swatches/js/swatch-renderer.js:511
    each jQuery
    disableSwatchForOutOfStockProducts Magento_Swatches/js/swatch-renderer.js:504

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes magento/magento2#<issue_number>

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

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

Issue: needs updateAdditional information is require, waiting for responsePriority: P2A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.xIndicates original Magento version for the Issue report.

Type

No type

Projects

Status

Ready for Development

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions