Skip to content

Instantly share code, notes, and snippets.

@MaryOJob
Created August 23, 2021 16:30
Show Gist options
  • Select an option

  • Save MaryOJob/749ad7b04c4dd360d36bb9092200491f to your computer and use it in GitHub Desktop.

Select an option

Save MaryOJob/749ad7b04c4dd360d36bb9092200491f to your computer and use it in GitHub Desktop.
Make the PMPro "Phone" Field to not be required
<?php // do not copy this line
/**
* This recipe removes makes the phone field to not be required at checkout
* Note: Make sure your Gateway doesn't require these fields.
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_not_required_billing_fields( $fields ) {
if ( is_array( $fields ) ) {
unset( $fields['bphone'] );
}
return $fields;
}
//run it later in the queue if necessary if other plugins or code sets fields required, e.g. change 50 to a higher number.
add_action( 'pmpro_required_billing_fields', 'my_pmpro_not_required_billing_fields', 50, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment