0

I have a simple product with options. When I add to the cart and buy, I have a new SKU with the delimiter '-'. I would like to change the delimiter, where can I do that?

Example simple product SKU: AAA

and has custom options Sku Option 1

A1A1A1 A2A2A2

Option 2

B1B1B1 B2B2B2

On the Product page, SKU is showing AAA is fine. Now if the customer Added to the cart and chooses the first option in both sections for this product its SKU Becomes AAA-A1A1A1-B1B1B1 in the cart and the Order

I want to change it's separator from - to + so the result SKU becomes AAA+A1A1A1+B1B1B1

2 Answers 2

0

The Sku delimiter is defined in method getOptionSku of the class Magento\Catalog\Model\Product\Type\AbstractType .

Just change the value of $skuDelimiter

Editing Vendor files is not advised, since the getOptionSku is public you can use a plugin: https://developer.adobe.com/commerce/php/development/components/plugins/

0
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Model\Product\Type\Simple" type="Vendor\OrderSync\Model\Rewrite\Product\Type\Simple" />
</config>

enter image description here

Work!If you have Virtual Products don't forget to do the same.

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.