Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rezaulhreza's avatar

Use coupon once or twice based on the coupons table

removed code

0 likes
4 replies
jlrdw's avatar

Have a counter column and update it until it reaches 0 or if using amount, update with the new amount that's left on the coupon.

1 like
rezaulhreza's avatar

@jlrdw I am afraid my head's stuck right now. Can you please help me in that case by explaining through code?

Thanks

hupp's avatar

Difficult to understand your code but solution are so essay here you need to when user use the coupon at that time you need to reduce max use like if you set max uses 2 time so when any user use that coupon update max uses value as 1

and if you manage with different column then you need to increment that another column and when both column value are same then no more use possible.

1 like

Please or to participate in this conversation.