Embed Snippet on Your Site
MemberPress: Allow Coupon for Active Members Only
The code snippet will display the error if an inactive member (user/guest without any active subscriptions) tries to register using a specified coupon.
Though users can apply the coupon (any discounts it provides will also be calculated), they won't be able to complete the checkout process. Instead, an error message will be displayed.
The example code will display the "This coupon code is only valid for active members" error message if the THECOUPONCODE coupon code is used.
The code snippet should be updated by replacing the THECOUPONCODE coupon code with the actual coupon, on this line:
define( 'ACTIVE_MEMBER_COUPON', 'THECOUPONCODE' );
To modify the error message displayed, adjust the This coupon code is only valid for active members text on this line:
$errors[] = "This coupon code is only valid for active members";
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments