Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save travislima/75686a4244f0e924b5d314d60bad1eab to your computer and use it in GitHub Desktop.
Save travislima/75686a4244f0e924b5d314d60bad1eab to your computer and use it in GitHub Desktop.
Remove Billing Address for certain Membership Levels
<?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