I have a configurable product with many options. How can I update the sku based on selected options? I have followed this answer, but I am stuck at the JavaScript part. I try to get the this.config.skus, but I can't find out how.

Could someone provide a working example?
I am using Magento 2.1. Thank you!

  • I'm trying to do the same thing in 2.1 and cannot find a solution
    – Alex
    Commented Jan 3, 2017 at 11:02
  • Isn't that Magento 2 standard? Is there something like Better Configurable Products for Magento 2 ?
    – Alex
    Commented Sep 19, 2017 at 8:52

1 Answer 1


Out of the box, when choosing options, images, price, etc will change, but not SKU.

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.

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.

  • Not able to install vct/changeskudynamically module using composer Commented Mar 1, 2023 at 11:11
  • What error occurs?
    – Victor S.
    Commented Mar 1, 2023 at 18:46

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.