Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Hide billing address fields and make them optional.
- */
- //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 .pmpro_checkout-fields div {
- display: none;
- }
- #pmpro_billing_address_fields div.pmpro_checkout-field.pmpro_checkout-field-bzipcode {
- display: block;
- }
- </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['bcountry']);
- unset($fields['bphone']);
- }
- return $fields;
- }
- add_action('pmpro_required_billing_fields', 'my_pmpro_required_billing_fields');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement