Skip to content

mageSwatchRenderer is undefined on PDP #36937

Open
@Mugentoki

Description

@Mugentoki

Preconditions and environment

  • Magento version: 2.4.5-p2
  • Clean installation with demo data
  • Blank or Luma theme

Steps to reproduce

After setting up the fresh M2 instance with demo data

  1. Go to any product with swatches (size, color)
  2. In developer console, try to access the swatch renderer with
    jQuery('[data-role=swatch-options]').data('mageSwatchRenderer')

Expected result

Swatch renderer should be initialized and data be accessible
image

Actual result

Swatch renderer is undefined
image

Additional information

I still had a clean installed M2 version 2.3.4 around, and there it's working just fine.

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
    Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
    Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
    Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
    Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Activity

m2-assistant

m2-assistant commented on Mar 1, 2023

@m2-assistant

Hi @Hoargarth. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

Mugentoki

Mugentoki commented on Mar 1, 2023

@Mugentoki
Author

@magento give me 2.4-develop instance

magento-deployment-service

magento-deployment-service commented on Mar 1, 2023

@magento-deployment-service

Hi @Hoargarth. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service

magento-deployment-service commented on Mar 1, 2023

@magento-deployment-service
self-assigned this
on Mar 1, 2023
m2-assistant

m2-assistant commented on Mar 1, 2023

@m2-assistant

Hi @engcom-Dash. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

Mugentoki

Mugentoki commented on Mar 1, 2023

@Mugentoki
Author

Checked on the radiant-tee /radiant-tee.html
And can reproduce the issue

image

Mugentoki

Mugentoki commented on Mar 1, 2023

@Mugentoki
Author

There's this file in vendor vendor/magento/module-swatches/view/frontend/web/js/configurable-customer-data.js which is referencing mageSwatchRenderer

    var selectors = {
            formSelector: '#product_addtocart_form',
            swatchSelector: '.swatch-opt'
        },
        swatchWidgetName = 'mageSwatchRenderer',
        widgetInitEvent = 'swatch.initialized',




However, further inspecting the jQuery object in browser I can see it's actually attached with mage-SwatchRenderer and can be accessed like that jQuery('[data-role=swatch-options]').data('mage-SwatchRenderer')

image


So the question now arises, which one is correct?
mageSwatchRenderer or mage-SwatchRenderer

engcom-Dash

engcom-Dash commented on Mar 1, 2023

@engcom-Dash
Contributor

@magento give me 2.4-develop instance

magento-deployment-service

magento-deployment-service commented on Mar 1, 2023

@magento-deployment-service

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

engcom-Dash

engcom-Dash commented on Mar 2, 2023

@engcom-Dash
Contributor

Hi @Hoargarth ,

Thanks for Raising this issue,

Could you please provide the exact steps which you followed for this issue.Because it will helps to proceed further in this case.

Thanks.

43 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @mrtuvn@Mugentoki@engcom-November@engcom-Dash@github-jira-sync-bot

      Issue actions

        mageSwatchRenderer is undefined on PDP · Issue #36937 · magento/magento2