Forum Academy Marketplace Showcase Pricing Features

Allowing coupon code to be used once per user

I’m trying to work out the best way of allowing a user to only use a coupon code once, as an introductory offer.

I have a data type of coupon with usage limits of total number and expiry date, but i’m guessing I could add a field called excluded users, and add the user to that list once they’ve used it once?

Or maybe you can create another field called “Used coupons” in users table and add that coupon to this list once user uses it. When user is trying to use that coupon, you just search for that coupon in Current users Used coupons and process it accordingly. Accessing “current users” data is bit faster than searching in the DB.

Hi there, @emma1… if it was me, I would go with the excluded users list on the coupon data type. With that list in place, you can simplify things a bit by using the list to check both the usage limit (i.e., a count of users in the list) and the once-per-user restriction (i.e., is the current user in the list). Also, if you structure a conditional such that you check the expiration date first, then check the list count, and finally check the user restriction, the system won’t have to check the user restriction if the limit has been reached, and it won’t have to check the user restriction or the list count if the coupon has expired.

Hope this helps.

Best…
Mike

1 Like

thanks so much @mikeloc and @maheshkasindi - that’s helped me sense check what I was doing.

2 Likes