Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created July 8, 2020 06:03
Show Gist options
  • Save ipokkel/fbf4c8e9dbd29dc47b32ef84e5bc4478 to your computer and use it in GitHub Desktop.
Save ipokkel/fbf4c8e9dbd29dc47b32ef84e5bc4478 to your computer and use it in GitHub Desktop.
Remove the Phone and Address 2 fields from the required billing fields for PMPro checkout.
<?php
/**
* This recipe can be used to remove the Phone and Address 2 fields
* from the required billing fields for checkout.
*
* Note: Make sure your Gateway doesn't require it also.
*
* 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 pmpro_dont_require_billing_fields( $fields ) {
unset( $fields['bphone'] );
unset( $fields['baddress2'] );
return $fields;
}
add_filter( 'pmpro_required_billing_fields', 'pmpro_dont_require_billing_fields' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment