Skip to content

Instantly share code, notes, and snippets.

@femiyb
Forked from andrewlimaza/billing-fields-optional.php
Last active October 10, 2019 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save femiyb/5b667588ecba79a5912382975c0724a4 to your computer and use it in GitHub Desktop.
Save femiyb/5b667588ecba79a5912382975c0724a4 to your computer and use it in GitHub Desktop.
Make billing details optional for Paid Memberships Pro
<?php
//add lines 4-15 to your custom plugin or functions.php of your active theme
function pmpro_remove_bfields( $pmpro_required_billing_fields ){
//remove field ID's from array to make fields required
$remove_field = array('bphone');
//loop through the $remove_field array and unset each billing field to make it optional.
foreach($remove_field as $field){
unset($pmpro_required_billing_fields[$field]);
}
return $pmpro_required_billing_fields;
}
add_filter('pmpro_required_billing_fields', 'pmpro_remove_bfields');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment