Prevent from appending SKUs of product with custom option in Magento 2

If a product having custom option, its SKU is created on the fly.
If you look at file.

MagentoRoot\vendor\magento\module-catalog\Model\Product\Type\AbstractType.php

You will find a function getOptionSku, which is responsible for creating SKU.

If you want to remove custom option SKU to main product’s SKU, You can change to

**$sku**

From

**$sku .= $skuDelimiter . $optionSku;**

Where

$sku = SKU of product
$skuDelimiter = –
$optionSku = SKU of custom option of product

You can change as per your requirement.

**Note:** Never edit core files, you need a proper Model overriding. For test purpose you can check by putting die below this sku generation code and add a product from front.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.