3ART Technologies
2020-06-20T11:03:50Z
Hi,
From the backend C#, I want to implement the coupon code at "CART Page". "The Add a Promotional Code:" is not adding in the order service.

The below code returning me True, but when I see the list of coupon code under my cart list it will exist empty.

var HccApp = HccAppHelper.InitHccApp();
var cart = HccApp.OrderServices.CurrentShoppingCart();
bool returnValue = cart.AddCouponCode(coponCode);

Can anyone tell me why it is behaving like that? or there is some other class to add the coupon code in the cart item

nothing


Regards
3ART Technologies
2020-06-20T11:45:33Z
The function adding the item into the list but not value is not saving into the database, did I need to update the cart if yes please inform me what is the function for it
3ART Technologies
2020-06-20T11:53:30Z
Found the solution

var HccApp = HccAppHelper.InitHccApp();
var cart = HccApp.OrderServices.CurrentShoppingCart();


cart.AddCouponCode(coponCode);
// Important to update your cart
HccApp.OrderServices.Orders.Update(cart, true);

bool returnValue = cart.AddCouponCode(coponCode);
return returnValue;

Loading
  • Sign-up for the Hotcakes Community Newsletter: