AI OnAI Off
In thory yes, If you define stiching as a variant of your product and add that variant in basket. (Variants will have their unique skus, will not require to display on website.)
/K
If you manually create a line item instead of using CartHelper.AddEntry then you can add the line item to OrderForm.LineItems collection which should allow you to add as long as the line item object is not exactly the same.
I aggree with you Mark. we needed you to add manually. CartHelper checks the lineitem code exist in order if it does exist than updates the quantity only.
This is the manually adding the item to order but this does not work some how.
var orderForm = CartHelper.Cart.OrderForms.FirstOrDefault(); LineItem lineItem =orderForm.LineItems.FirstOrDefault(i => i.Code == product.Code); if(lineItem !=null) { lineItem.SetMetaField(Constants.Metadata.LineItem.RefNumber, "some value"); lineItem.SetMetaField(Constants.Metadata.LineItem.IsConfigured, true); orderForm.LineItems.Add(lineItem, lineItemRollup:false); //NOTE THIS LINE : To have two lineItems for the same SKU, set the bool LineItemRollup (second arg.) to false orderForm.AcceptChanges(); }
her is the solution. this works
var orderGroup = (OrderGroup)CartHelper.Cart; var form = orderGroup.OrderForms.FirstOrDefault(); var newLineItem = form.LineItems.AddNew(); newLineItem.ParentCatalogEntryId = lineItem.ParentCatalogEntryId; newLineItem.Code = lineItem.Code; newLineItem.SetParent(lineItem.Parent); newLineItem.AcceptChanges();
Hi,
Is it possible to add an item more than once to cart as new line. ?
example you have an item Code="xyz". and add this item to cart with a an costum field "stiching".
lineitem 1 => code="xyz" , stiching="Black stitches"
lineitem 2 => code="xyz" , stiching="Dark grey stitches"
lineitem 3 => code="xyz" , stiching="White stitches"
notice these items has same sku code.
Thanks in advance.