If a customer applies certain coupon at checkout, I'm adding an item into cart using below code. It does add the item however, the item shows up in non-shipping items order confirmation and packing slip won't show this item either. Other items of the cart appears perfectly fine. Also, if this same item is added by customer from product page, it does appear just fine. Please advice why manually adding this item into basket is causing this problem... am i missing any code?
Code: Select all
CouponProduct cp = coupon.CouponProducts[0];
if (basket.ContainsProduct(cp.ProductId) == false)
{
BasketItem basketItem = CommerceBuilder.Orders.BasketItemDataSource.CreateForProduct(cp.ProductId, 1);
basketItem.BasketId = basket.BasketId;
basket.Items.Add(basketItem);
basket.Save();
basket.Recalculate();
}
thanks.