MemberPress: Require Specific Coupon to Register

function mepr_only_with_coupon( $errors ) { $membership_id = 123; //Change this ID to your membership ID $coupons = array( ‘IMRECOMMENDED’, ‘DISCOUNTED’ ); //Change these titles to your coupon title(s) if( $_POST[‘mepr_product_id’] == $membership_id ) { if( !isset( $_POST[‘mepr_coupon_code’] ) || empty(…Continue reading

MemberPress: Require Coupon at Checkout

function mepr_must_fill_out_coupon_code( $errors ) { if( !isset($_POST[‘mepr_coupon_code’]) || empty($_POST[‘mepr_coupon_code’] ) ) { $errors[] = “You must fill out the Coupon code field before registering.”; } return $errors; } add_filter( ‘mepr-validate-signup’, ‘mepr_must_fill_out_coupon_code’, 11, 1 );Continue reading

MemberPress: Only Allow Coupon Once Per User

function custom_validate_coupon( $errors ) { global $wpdb; //If user is not logged in, then they’ve never used a coupon before if( !MeprUtils::is_user_logged_in() ) { return $errors; } $coupon_code = ( isset( $_POST[‘mepr_coupon_code’] ) && !empty( $_POST[‘mepr_coupon_code’] ) )?stripslashes( $_POST[‘mepr_coupon_code’] ):”;…Continue reading