Emporix has just released a new functionality that allows you to add the same product multiple times as separate line items in the cart !
What Changed?
Until now, whenever a product was added to the cart and it already existed, the system would simply increase the quantity of that item.
With the latest update, you can now add the same product as separate line items using a new flag:
keepAsSeparateLineItem (default: false)
{
"itemYrn": "urn:yaas:saasag:caasproduct:product:b2b2cstage;samsung-galaxy-s24-gross",
"keepAsSeparateLineItem":true,
"product":{
"id":"samsung-galaxy-s24-gross"
},
"price": {
"priceId": "679ca63dbcdefe5b380c98bc",
"effectiveAmount": 550,
"originalAmount": 550,
"currency": "EUR"
},
"quantity": 1
}
If this operation is executed twice, the product will appear in two separate line items in the cart.
Backward Compatibility
You can still add products without the keepAsSeparateLineItem flag. The behavior will remain the same β it will increase the quantity of the existing line item.
This flexibility also allows you to configure different options per line item, such as setting different cost centers or applying individual mix-ins.
Promotion Example: βBuy 2, Get 1 Freeβ
This feature integrates well with external discounts, making it easy to build promotions like Buy 2, Get 1 Free.
Step 1: Add 2 products with default behavior
{
"itemYrn": "urn:yaas:saasag:caasproduct:product:b2b2cstage;samsung-galaxy-s24-gross",
"keepAsSeparateLineItem":false, //optional as by default the value is false
"product":{
"id":"samsung-galaxy-s24-gross"
},
"price": {
"priceId": "679ca63dbcdefe5b380c98bc",
"effectiveAmount": 550,
"originalAmount": 550,
"currency": "EUR"
},
"quantity": 2
}
Step 2: In your BFF layer, detect this case and add a third line with a 100% external discount
{
"itemYrn": "urn:yaas:saasag:caasproduct:product:b2b2cstage;samsung-galaxy-s24-gross",
"keepAsSeparateLineItem":true,
"product":{
"id":"samsung-galaxy-s24-gross"
},
"price": {
"priceId": "679ca63dbcdefe5b380c98bc",
"effectiveAmount": 550,
"originalAmount": 550,
"currency": "EUR"
},
"externalDiscounts": [
{
"id": "buy-2-get-1-free",
"name": "Summer Sale Discount",
"discountType": "PERCENT",
"value": 100.00,
"sequence": 1
}
],
"quantity": 1
}
The external discounts require a special scope cart.cart_manage_external_prices
Final Result in the Cart
- Line 1: 2Γ product at full price
- Line 2: 1Γ product with 100% discount