Skip to content

Instantly share code, notes, and snippets.

@femiyb
Created March 22, 2020 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save femiyb/9eaff51d15865a4ac4b56d73300e153a to your computer and use it in GitHub Desktop.
Save femiyb/9eaff51d15865a4ac4b56d73300e153a to your computer and use it in GitHub Desktop.
<?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