No, this is not a known bug. I also tested on our latest Quicksilver and everything is fine. How do you add the item to the cart?
Hi Quan,
Here is my function to add item to cart:
private CartActionResult AddToCart(string name, LineItem lineItem) { CartHelper ch = new CartHelper(name); string messages = string.Empty; if (lineItem.Quantity < 1) { lineItem.Quantity = 1; } // Need entry for adding to cart var entry = CatalogContext.Current.GetCatalogEntry(lineItem.Code); ch.AddEntry(entry, lineItem.Quantity, false, new CartHelper[] { }); // Need content for easier access to more information ContentReference itemLink = _referenceConverter.GetContentLink(entry.CatalogEntryId, CatalogContentType.CatalogEntry, 0); EntryContentBase entryContent = _contentLoader.Get<EntryContentBase>(itemLink); if (string.IsNullOrEmpty(lineItem.ImageUrl)) { lineItem.ImageUrl = entryContent.GetDefaultImage(); } if (string.IsNullOrEmpty(lineItem.ArticleNumber)) { lineItem.ArticleNumber = entry.ID; } lineItem.Name = TryGetDisplayName(entry); messages = RunWorkflowAndReturnFormattedMessage(ch.Cart, OrderGroupWorkflowManager.CartValidateWorkflowName); ch.Cart.AcceptChanges(); return new CartActionResult() { Success = true, Message = messages }; }
Thanks!
John
While I can't explain why that happens - you can workaround by override the cart merging process and take the control yourself:
http://vimvq1987.com/2017/06/merging-carts-customer-logs/
I can't reproduce the problem on our WebForm sample site, which is using CartHelper like yours.
Hi John,
Does your site use VNext feature? Is there any shipment in your cart?
Ok, I think I found where's the issue and will file a bug for that. A workaround could be:
Or
/Bien
This fix was released as part of Commerce 11.1.0 - see http://world.episerver.com/documentation/Release-Notes/ReleaseNote/?releaseNoteId=COM-4812.
Hi All,
I am running into a weird issue that happens when you add line items to your cart while not being logged in. If the items exist in your logged in cart, they don't get merged with the non-logged in line items, a separate line item is created. Wondering if this is a known bug and if there is a work around? Below is a screen shot of a cart where this is happening.
Here are the versions of Episerver I am running:
Any help is greatly appreciated.
Thanks!
-John