Hi,
Received following reply from Technical kentico support team, Which worked for me. : -
The behavior of ShoppingCartInfo.SetShoppingCartItem method is that it increases quantity of the existing item with same parameters (mainly product options) instead of adding new separate item.
You can work your way around this behavior by using more low level code, something as:
...
// Create new shopping cart item with initialized item GUID
ShoppingCartItemInfo item = new ShoppingCartItemInfo();
// Initialize product properties
item.SKUID = itemParams.SKUID;
item.CartItemUnits = itemParams.Quantity;
item.CartItemPrice = itemParams.Price;
if ((cart == null) || (item == null))
{
return;
}
// Reference item to the shopping cart
item.ShoppingCartID = cart.ShoppingCartID;
item.ShoppingCart = cart;
// Add item to the shopping cart
cart.CartItems.Add(item);
// Set the cart item into DB
ShoppingCartItemInfoProvider.SetShoppingCartItemInfo(item)
// Invalidate cart calculations
cart.InvalidateCalculations();
...
It is also possible to override the default behavior od the SetShoppingCartItem method in custom provider, but as you're using custom code to add products to cart anyway, it may not be necessary.
If your item has options, you'd have to do a lot more following actions (save all the option items, process the price changes, etc.), but if you're using standard products without options, it should be sufficient.
If you're using product type Donation, then you may need to do some other steps too. Just let me know if that's the case in your scenario.