Last active
July 20, 2020 09:00
-
-
Save travislima/75686a4244f0e924b5d314d60bad1eab to your computer and use it in GitHub Desktop.
Remove Billing Address for certain Membership Levels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* This code recipe will remove the billing address fields from certain membership levels. | |
* This code gist requires the Paid Memberships Pro - Capture Name & Address for Free Levels or for Off-site Gateways Add On to be installed and activated - https://www.paidmembershipspro.com/add-ons/capture-name-address-free-levels-offsite-gateway/ | |
* Change the value "4" in the code recipe with the Paid Memberships Pro Membership Level ID of your choice. | |
* Add this code below into your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function remove_pmpro_billing_fields_by_level_id() { | |
// Specify the Membership Level ID | |
if ( 4 == $_REQUEST['level'] ) { | |
remove_action( 'pmpro_checkout_boxes', 'pmproaffl_pmpro_checkout_boxes_require_address', 10, 2 ); | |
remove_action( 'pmpro_required_billing_fields', 'pmproaffl_pmpro_required_billing_fields', 10, 2 ); | |
} | |
} | |
add_action( 'init', 'remove_pmpro_billing_fields_by_level_id', 9 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment