Hello everybody,
We've got a situation in which a BOM product is added with 0.00 price instead of it's actual price when programatically creating a new cart and a new orderline based on BOM product.
Basically there's a custom component that adds a product to another cart (either existing , or a new one) [1] and a list of user carts [2]
1.
2.
Issue is showcased in the following video : https://go.screenpal.com/watch/cZl6lLnnvo9
It works just fine for standard products
Can anyone think of a solution and why this behavior is occuring only for the BOM product?
Code Snippet
string productId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["ProductId"]) ? Dynamicweb.Context.Current.Request["ProductId"] : string.Empty; double quantity = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request["Quantity"]) ? Convert.ToDouble(Dynamicweb.Context.Current.Request["Quantity"]) : 0.00; bool addProduct = !string.IsNullOrEmpty(productId) && quantity != 0; var newCart = new Order(); newCart.IsCart = true; newCart.ShopId = Pageview.Area.EcomShopId; if (addProduct) { var product = Dynamicweb.Ecommerce.Services.Products.GetProductById(productId, "", Dynamicweb.Ecommerce.Common.Context.LanguageID); var newOrderLine = Dynamicweb.Ecommerce.Services.OrderLines.Create(newCart, product, quantity, null, product.Price); Dynamicweb.Ecommerce.Services.OrderLines.Save(newOrderLine); } Dynamicweb.Ecommerce.Services.Orders.Save(newCart);