I want to know how does Magento 2 sku generated automaticlly.

I wonder when I type product name while creating new product in admin then its sku is automatically typed in sku field.

I researched much and found that there is a functionality called "Modifier" in Magento 2 in which product edit section can be added/edited with some extra features.

Also found that there are two methods in modifier class, "modifyMeta" & "modifyData" that can be used to add/edit product edit fields.

But I am totally dumb that how sku is generated automatically and which file I will have to override to make sku in our own way.

Right now sku is generated based on product name but I want to make it something like somedigits+autogenerated_sku eg: 00000testsku.

Is there anyone who can hints at it and give some light on it?

1 Answer 1


For sku generation has settings: Stores -> Configuration -> Catalog enter image description here

Change Mask for SKU to somedigits_{{name}}


SKU js component: Magento_Catalog/js/components/import-handler

Location: vendor/magento/module-catalog/view/adminhtml/web/js/components/import-handler.js

Overwrite this component what you want here.

  • I know it but it will not work as expected that I asked in my question. Jul 16, 2019 at 17:57
  • Check updated answer
    – Sohel Rana
    Jul 16, 2019 at 18:05
  • Thanks mate!!!! Jul 19, 2019 at 12:19

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.