Forked from travislima/remove_pmpro_billing_fields_by_level_id.php
Last active
June 7, 2019 18:51
-
-
Save femiyb/e8fff462ecd344cd5cec2c54706f1bea 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 "2" 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 | |
$remove_level = isset( $_REQUEST['level'] ) ? $_REQUEST['level'] : ''; | |
if ( $remove_level == 2) | |
{ | |
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