MemberPress: Require Coupon Code for Specific Free Memberships
The code snippet should be updated to specify the membership ID for which the coupon code is required. The dummy ID of 123 should be replaced with the ID of the actual membership on this line:
The code snippet can also be applied to several memberships by adding multiple membership IDs separated by a comma on the same line:
$GLOBALS[‘free_memberships_require_coupon’] = array(123, 456);
The error message can be adjusted by modifying the A valid coupon code is required to sign up for this membership. error text on this line:
$errors[] = ‘A valid coupon code is required to sign up for this membership.’;
In addition, the code snippet will change the coupon field label text. The filed label can be adjusted by modifying the Coupon Code (Required)* label text on this line:
$(‘input[name=“mepr_coupon_code”]‘).before(‘Coupon Code (Required)*’);
Comments