Created
September 8, 2014 19:48
-
-
Save strangerstudios/b341f51c4afaf1d4444b to your computer and use it in GitHub Desktop.
Hide Paid Memberships Pro billing address fields and make them optional. Meant to be used with the Braintree gateway.
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
/* | |
Hide billing address fields and make them optional. | |
Meant to be used with the Braintree Payments gateway. | |
*/ | |
//css to hide the fields | |
function wp_head_hide_billing_fields() | |
{ | |
global $post, $pmpro_pages; | |
if(empty($pmpro_pages) || (!is_page($pmpro_pages['checkout']) && !is_page($pmpro_pages['billing']))) | |
return; | |
?> | |
<style> | |
#pmpro_billing_address_fields {display: none;} | |
</style> | |
<?php | |
} | |
add_action('wp_head', 'wp_head_hide_billing_fields'); | |
//make sure they aren't required | |
function my_pmpro_required_billing_fields($fields) | |
{ | |
if(is_array($fields)) | |
{ | |
unset($fields['bfirstname']); | |
unset($fields['blastname']); | |
unset($fields['baddress1']); | |
unset($fields['baddress2']); | |
unset($fields['bcity']); | |
unset($fields['bstate']); | |
unset($fields['bzipcode']); | |
unset($fields['bcountry']); | |
unset($fields['bphone']); | |
} | |
return $fields; | |
} | |
add_action('pmpro_required_billing_fields', 'my_pmpro_required_billing_fields'); |
Hi,
how do I set payments fields as not required on pmpro ?
did you manage to resolve that @serieseyw ? I am looking for similar solution
same here, how to make fields not required?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Know this is old and some options have changed, but this still works for Stripe to at least make them not required. I do this to hide individual fields in Stripe if I need some but not all. I use jQuery which should be pretty standard across payment types: