Separate Line Items based on Quantity
I am working with connecting my Commerce and Commerce Registration website with Salesforce and I need to get some information from the registrations into the line item in order to map properly (there is no many-to-many or one-to-many mapping options in the current salesforce drupal suite..)
In order for this to work initially, I need every registration product that get's added to the cart to be separated. This is naturally done for separate SKUs, but I am focusing more on the same SKU added to the cart with a QTY larger than 1, get separated out into different line items with their own ID.
I have looked around and mainly found the same answers which non have worked (Turn off the "combine liked products.." in all the product/line item displays). Other Rule based options I have tried work for the initial add to cart, but if someone then updates the qty on the cart page it breaks or if they then go back to the product and re-add it, it messes up the amount of line items in the cart.
My goal to to be able to separate them, add an Attendee field to the Line Item, then after saving the registration entity it should populate that Attendee field on the Line Item with the email address or Full Name of the registrant. This way I can push that info to Salesforce in a single Line Item -> Order Product mapping.
Any help would be greatly appreciated.
Comments
Just to add you probably noticed the "List Remove" action. This removes the original line item with it's original quantity. Without this, if you added a product with qty 5, you would end up with 6 line items. 1 with a qty of 5, and another 5 with the qty of 1.
I also changed the cart View display to only show the Quantity, and not the Quantity Text which allows people to further change their qty in the cart.