2

I will try to be as clear as possible. On the configurable products pages, when the customer chooses his product configuration, the price display changes according to the price of the configuration.

So far, everything is normal.

However, I will use the SKU as an example.

When changing the configuration, the SKU display does not change. It always displays the SKU of the configurable product, not the SKU of the declination or configuration.

How can Magento make this change? Which file manages this update of data to be displayed?

Thank you in advance!

Florian

Magento Version: 2.3.1 CE

EDIT: I don't know why, but Stackexchange refuses me "Hello all," at the beginning of my post. Sorry for that.

3

1 Answer 1

0

In order to display the SKU of the selected product, you can create a Plugin (Interceptor) for Magento\ConfigurableProduct\Block\Product\View\Type\Configurable::getJsonConfig() where you need to add missing SKU for each simple product. Out of the box, when choosing options, images, price, etc will change, but not SKU.

The SKU obtained with getJsonConfig() can be updated in the frontend when selecting an option in vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js or/and vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js depending on the type of attribute (Dropdown, Visual Swatch, Text Swatch).


I made VCT Product Info Switcher module that solve this problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.