Created
March 22, 2020 18:21
-
-
Save femiyb/9eaff51d15865a4ac4b56d73300e153a to your computer and use it in GitHub Desktop.
This file contains 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 | |
/* Copy from below this line */ | |
function pmpro_remove_bfields( $pmpro_required_billing_fields ){ | |
//remove field ID's from array to make fields required | |
$remove_field = array('bfirstname', 'blastname'); | |
//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'); | |
add_action( 'wp_head', 'wp_head_hide_billing_name_field' ); | |
function wp_head_hide_billing_name_field() { | |
global $pmpro_pages; | |
if ( empty( $pmpro_pages ) || ( ! is_page( $pmpro_pages['checkout'] ) && ! is_page( $pmpro_pages['billing'] ) ) ) { | |
return; | |
} | |
?> | |
<style> | |
div.pmpro_checkout-field-bfirstname, div.pmpro_checkout-field-blastname { | |
display: none; | |
} | |
</style> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment