To answer you question:
The matching is done by the method Magento\Quote\Model\Quote\Item::representProduct()
.
This method checks if a certain item in the cart is the same as the product you are just adding to the cart.
Making this method always return false
should make any add to cart action add the product as a new line in the cart.
For this you can use an aroundPlugin
.
Create a new module and in the etc/di.xml
add this
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Quote\Model\Quote\Item">
<plugin name="[module]-quote-item" type="[Namespace]\[Module]\Plugin\Quote\Item" />
</type>
</config>
Then create the file [Namespace]/[Module]/Plugin/Quote/Item.php
with this content.
<?php
namespace[Namespace]\[Module]\Plugin\Quote;
use Magento\Quote\Model\Quote\Item as QuoteItem;
class Item
{
public function aroundRepresentProduct(QuoteItem $subject, \Closure $proceed, $product)
{
return false;
}
}
Or a second option could be this. The code is for Magento 1, but you can adapt it for M2. The event recommended in there, sales_quote_add_item
, still exists in M2.
To solve your problem, maybe...
If you are planning to sell ropes with fixed lengths maybe you should use configurable products.