Magento 2.4 – Change SKU Dynamically in Configurable Product

configurable-productmagento-communitymagento2.4.3product-page

Does anybody know how to implement changing of the SKU on configurable product page according to variation selection, for Magento 2.4.3?

Thanks!

Best Answer

In order to display product 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.

Switching SKU when selecting an option can be implemented in vendor/magento/module-swatches/view/base/web/js/swatch-renderer.js and vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js depending on the type of attribute.


I made free VCT Change SKU Dynamically module that solve this problem.