Home / Archive / MemberPress: Require Coupon at Checkout
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Require Coupon at Checkout

Make the coupon field required at checkout.

Code Preview
php
<?php
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 );

Comments

Add a Comment

  1. Hello, I would like to have a snippet that can create a coupon when a new user is registered and have purchased a membership. As I have installed AffiliateWP and that user become an affiliate automatic, can be possible to create another snippet that can assign this created coupon to this new affiliate? I would appreciate it because this has been very useful.