Hello,
Check Attached image.
https://ibb.co/kmPHE5
GetAllDiscountsForCaching() Returns Null So we can't use there property. Its returning Object reference not set to an instance of an object.
Thanks,
Jatin
var discount = _discountService.GetAllDiscountsForCaching(couponCode: couponCode).FirstOrDefault(d => d.RequiresCouponCode && _discountService.ValidateDiscount(d, _workContext.CurrentCustomer).IsValid);
if(discount != null)
{
model.DiscountBox.AppliedDiscountsWithCodes.Add(new ShoppingCartModel.DiscountBoxModel.DiscountInfoModel()
{
Id = discount.Id,
CouponCode = discount.CouponCode
});
}