Quantcast
Channel: Customized Commerce 13 and earlier versions
Viewing all articles
Browse latest Browse all 9642

Cannot update line items quantity in cart

$
0
0

LineItem quantity will not save, what do i do? 

private List<LineItem> IncreaseOrDecreaseQuantity(string productCode, bool decrease)
{
var contactId = PrincipalInfo.CurrentPrincipal.GetContactId();
var cart = _orderRepository.LoadOrCreateCart<ICart>(contactId, "Default");
var currentCartItems = GetCartItems();
var lineItem = currentCartItems.FirstOrDefault(x => x.Code.Equals(productCode));
var value = decrease ? -1 : 1;
if (lineItem != null)
cart.UpdateLineItemQuantity(cart.GetFirstShipment(), lineItem, lineItem.Quantity + value);
_orderRepository.Save(cart);
var a = cart.GetAllLineItems();
return currentCartItems;
}


_orderRepository = IOrderRepository


Viewing all articles
Browse latest Browse all 9642

Trending Articles