that forces the code to all lower case. Now i just make sure that I enter only lower case when I set the codes up, and it will not matter how the user enters it, it will match.
if (this.RequiresCouponCode && !String.IsNullOrEmpty(this.CouponCode)) { if (!couponCodeToValidate.Equals(this.CouponCode, StringComparison.InvariantCultureIgnoreCase)) return false; }
or this
if (this.RequiresCouponCode && !String.IsNullOrEmpty(this.CouponCode)) { if (couponCodeToValidate.Equals(this.CouponCode, StringComparison.InvariantCultureIgnoreCase)) return true; }
You don't want to use the second suggested change (return true after the comparison) as this would skip the other validations ("deleted" check and "start/end date" check) for the coupon code later in the method. The first change (adding !) is needed though.
I'm using this workaround for my solution. Can one of these solutions be added to the next build? I can't see a reason why the coupon code would ever need to be case sensitive.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.