Looking for a way to test if a redemption coupon code has been used? I currently have a page that will be sold with specific post page access. The specific page has a booking form and the idea is to restrict access on a one time use only. So, I want to sell a coupon that can only be used on the pro-form, and once used, then have access to the booking form page. If user returns to the page after the use of the coupon, then user has to purchase another coupon before user can access the booking form. This is one way I can think of to accomplish this scenario, however, I am open to other ideas.
How to check if a coupon code has been used
@Tim…thank you…that is the concept I used for setting up the specific page. The only remaining part is how to test if the coupon has been used. I understand there is counter that is incremented each time the coupon is used, but not sure how to access the counter or how to test it on a page.
I think you’ll need some custom coding for that. This should get you started: https://s2member.com/kb-article/php-to-access-user-coupon-codes/
I have copied the code into a page using the text editor and ezphp activated, expecting it will display the oldest and newest coupon used, but nothing…how can I test this code?
You’d need to add something to make it display. Try changing the last part to this:
if(is_array($user_coupons) && !empty($user_coupons))
{
$oldest_coupon_code = $user_coupons[0];
$newest_coupon_code = $user_coupons[count($user_coupons) - 1];
echo $oldest_coupon_code;
echo $newest_coupon_code;
}
Thanks @Tim. Unfortunately, my site is using visual composer and it does display php, even with ezphp!..is there any other way to make this work?
Sorry, I have no idea. I avoid Visual Composer.
Thanks again @Tim. I will explore if the code can be adapted to be added to the s2-hack (mu-plugin).