MemberPress: Remove State Field for ReadyLaunch™

function trim_down_address_fields( $options ) { foreach( $options->address_fields as $i => $o ) { if( $o->field_key == ‘mepr-address-state’ ) { unset( $options->address_fields[$i] ); } } return $options; } add_filter( ‘mepr_fetch_options’, ‘trim_down_address_fields’ ); //Add a fake state value to each user function…Continue reading

MemberPress: Set the order of payment methods

function mepr_rearrange_payment_methods( $payment_methods, $key ) { //Modify the order of the payment methods below according to your needs. You can also remove non needed payment methods $order = array( “PayPal Standard”, “Stripe”, “Authorize.net Profile”, “Offline Payment”, ); $pm_map = array();…Continue reading

MemberPress: Set Custom Product Pages

function mepr_is_product_page( $return, $post ) { $custom_pages = array( 1, 2, 3 ); //Replace these numbers with the post ID’s of the pages if( isset( $post ) && in_array( $post->ID, $custom_pages ) ) { return true; } return $return; }…Continue reading

MemberPress: Disable Address Fields for a Specific Membership

function mepr_disable_address_fields( $fields ) { if ( is_single( array( 12, 564 ) ) ) { $hide_fields = array( ‘mepr-address-state’, ‘mepr-address-zip’, ‘mepr-address-one’, ‘mepr-address-two’, ‘mepr-address-city’, ‘mepr-address-country’, ); foreach ( $fields as $key => $field ) { if ( isset( $field->field_key ) &&…Continue reading

MemberPress: Remove all but nine countries from the drop-down

function mepr_remove_countries( $countries, $prioritize_my_country ) { return array( ‘AU’ => _x( ‘Australia’, ‘ui’, ‘memberpress’ ), ‘CA’ => _x( ‘Canada’, ‘ui’, ‘memberpress’ ), ‘DK’ => _x( ‘Denmark’, ‘ui’, ‘memberpress’ ), ‘FR’ => _x( ‘France’, ‘ui’, ‘memberpress’ ), ‘DE’ => _x( ‘Germany’,…Continue reading

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