Created
August 23, 2021 16:30
-
-
Save MaryOJob/749ad7b04c4dd360d36bb9092200491f to your computer and use it in GitHub Desktop.
Make the PMPro "Phone" Field to not be required
This file contains hidden or 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 // 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