Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Customizations to use the "Capture Name & Address for Free Levels or for Offsite Gateway" add-on
<?php
/*
Plugin Name: PMPro Customizations: Required Field Changes
Plugin URI: https://eighty20results.com/paid-memberships-pro/do-it-for-me/
Description: Customizations to disable required fields for some of the Address/Addon.
Version: 1.0
Author: Eighty / 20 Results by Wicked Strong Chicks, LLC <thomas@eighty20results.com>
Author URI: https://eighty20results.com/thomas-sjolshagen/
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
License: GPLv2 or later
*/
/*
* Copyright (c) 2017 - Eighty / 20 Results by Wicked Strong Chicks.
* ALL RIGHTS RESERVED
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function ic_hide_paypal_link() {
global $show_paypal_link;
if ( true === $show_paypal_link ) {
$show_paypal_link = false;
add_filter( 'pmpro_include_billing_address_fields', '__return_true', 30 );
add_filter( 'pmpro_include_payment_information_fields', '__return_false', 30 );
}
}
add_filter( 'pmpro_billing_preheader', 'ic_hide_paypal_link' );
function ic_required_field_filter( $fields ) {
unset( $fields["baddress1"] );
unset( $fields["bcity"] );
unset( $fields["bstate"] );
unset( $fields["bzipcode"] );
unset( $fields["bcountry"] );
return $fields;
}
add_filter( 'pmpro_required_billing_fields', 'ic_required_field_filter', 40 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.