2

We use magento 2.2.2 and we need a longer SKU. We set "const SKU_MAX_LENGTH = 255;" in the file module-catalog/Model/Product/Attribute/Backend/Sku.php but it does not work

2
  • You also need to increase it in database Jun 20, 2018 at 7:42
  • What is the error you are getting? Jun 20, 2018 at 7:44

3 Answers 3

2

You need to change the into database as well. Goto table eav_attribute, search for sku at column attribute code then edit the resulted row.

Update the field frontend_class to null or validate-length maximum-length-255 according to your requirement.

Now check the admin it works.

2

You have to change field size at the database table.

ALTER TABLE `catalog_product_entity` CHANGE `sku` `sku` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'SKU';
1
  • If we run setup:upgrade, It changes this field to VARCHAR(64) again. Any idea why? Sep 8, 2021 at 13:59
0

you can install this module it will increase sku length upto 255 https://github.com/Mehran515/Increase-Sku-Length

3
  • Please disclose affiliation when linking to your own content. Oct 19, 2023 at 15:28
  • what how do i disclose affiliation?
    – Mehran
    Oct 20, 2023 at 6:18
  • A simple "This is my repository" or something to that effect will do. Oct 20, 2023 at 13:44

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.