You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding the coupon to the shopping cart using CartModuleController.AddCartCoupon, the coupon code is not saved in the database.
I checked the code and it looks like ShoppingCartBuilder sets the property value ShoppingCart.Coupon. However, the conversion to the entity loses that value in the method ShoppingCart.FromModel:
if (model.Coupon != null)
{
// The coupon code is stored in the Coupons collection
Coupons = new ObservableCollection<CouponEntity>(new[] { new CouponEntity { Code = model.Coupon } });
}
if (model.Coupons != null)
{
// The coupon code save above is erased by the line below
Coupons = new ObservableCollection<CouponEntity>(model.Coupons.Select(x => new CouponEntity { Code = x }));
}
The text was updated successfully, but these errors were encountered:
Hello, @azapotoczny-forte !
Thank you for your appeal.
The above code is legacy code. To implement the functionality you need, we can recommend two ways:
Using the API, in order to apply coupons, you need to implement saving the cart manually.
When adding the coupon to the shopping cart using
CartModuleController.AddCartCoupon
, the coupon code is not saved in the database.I checked the code and it looks like
ShoppingCartBuilder
sets the property valueShoppingCart.Coupon
. However, the conversion to the entity loses that value in the methodShoppingCart.FromModel
:The text was updated successfully, but these errors were encountered: