3ART Technologies
2020-06-14T20:39:20Z
I want to reduce the quantity and remove the item from the cart through the serverside script. Can you please inform me which class and method fulfils this requirement
3ART Technologies
2020-06-14T22:35:36Z
Hi i got the way to update the cart

// create a reference to the Hotcakes store
var HccApp = HccAppHelper.InitHccApp();
// get an instance of the product to add
var p = HccApp.CatalogServices.Products.Find(bvin);
// create a reference to the current shopping cart
Order currentCart = HccApp.OrderServices.EnsureShoppingCart();
try
{
foreach (LineItem lineItem in currentCart.Items)
{
if (lineItem.ProductId.ToString() == bvin.ToString())
{
if (Convert.ToInt32(qty) == 0)
{
currentCart.Items.Remove(lineItem);
HccApp.CalculateOrderAndSave(currentCart);
}
else
{
lineItem.Quantity = lineItem.Quantity - 1;
HccApp.CalculateOrderAndSave(currentCart);
}
}
}

}
catch
{

}



Loading
  • Sign-up for the Hotcakes Community Newsletter: