1
                    $product
                           ->setPrice($price)
                           ->setSpecialPrice($price)
                           ->setTierPrice([])
                           ->setBasePrice($baseprice)
                           ->setOriginalCustomPrice($price);
                                /** @var \Magento\Framework\DataObject $request */
                           $request = $this->dataFactory->create();
                           $request->setData('qty', (int)$qty
                           $quote->addProduct($product, $request);

I have added the products to quote using the above code. But this merges the row qty for same SKU (as it supposes to).

How to create 2 different item-lines for the same SKU?

2

You can customize method Magento\Quote\Model\Quote\Item::representProduct() to return false if the product SKU matches your criteria.

Reference post: Magento 2: How to Prevent item's quantity from being added

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.