Title: Customizing Checkout PHP Errors
Last modified: August 30, 2016

---

# Customizing Checkout PHP Errors

 *  [jh71612](https://wordpress.org/support/users/jh71612/)
 * (@jh71612)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/customizing-checkout-php-errors/)
 * I’m trying to make the email field not required during checkout. I’m adding the
   following code to my child theme functions.php but get an error:
 * add_filter( ‘woocommerce_billing_fields’, ‘wc_npr_filter_email’, 10, 1 );
    function
   wc_npr_filter_email( $address_fields ) { $address_fields[‘billing_email’][‘required’]
   = false; return $address_fields; }
 * Here is my functions.php file:
    <?php // // Recommended way to include parent
   theme styles. // (Please see [http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme](http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme))//
   add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ ); function theme_enqueue_styles(){
   wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’);
   wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’,
   array(‘parent-style’) ); } // // Your code goes below // add_action( ‘init’, ‘
   jk_remove_storefront_header_search’ ); function jk_remove_storefront_header_search(){
   remove_action( ‘storefront_header’, ‘storefront_product_search’, 40 ); } add_action(‘
   init’, ‘custom_remove_footer_credit’, 10 );
 * function custom_remove_footer_credit () {
    remove_action( ‘storefront_footer’,‘
   storefront_credit’, 20 ); add_action( ‘storefront_footer’, ‘custom_storefront_credit’,
   20 ); }
 * function custom_storefront_credit() {
 * add_filter( ‘woocommerce_billing_fields’, ‘wc_npr_filter_email’, 10, 1 );
    function
   wc_npr_filter_email( $address_fields ) { $address_fields[‘billing_email’][‘required’]
   = false; return $address_fields;  } ?> <div class=”site-info”> © Ageless Iron
   TV <?php echo get_the_date( ‘Y’ ); ?> </div><!– .site-info –> <?php } add_filter(‘
   wp_nav_menu_items’, ‘add_loginout_link’, 10, 2 ); function add_loginout_link(
   $items, $args ) { if (is_user_logged_in() && $args->theme_location == ‘primary-
   menu’) { $items .= ‘
    - [Log Out](https://wordpress.org/support/topic/customizing-checkout-php-errors/&apos;. wp_logout_url(&apos;agelessirontv.com&apos;) .&apos;?output_format=md)
    - ‘;
       } elseif (!is_user_logged_in() && $args->theme_location == ‘primary-menu’){
      $items .= ‘
    - [Log In](https://wordpress.org/support/topic/customizing-checkout-php-errors/&apos;. site_url(&apos;agelessirontv.com&apos;) .&apos;?output_format=md)
    - ‘;
       } return $items; }
    - [https://wordpress.org/plugins/woocommerce/](https://wordpress.org/plugins/woocommerce/)

Viewing 1 replies (of 1 total)

 *  [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * (@lorro)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/customizing-checkout-php-errors/#post-6837690)
 * There is an extraneous non-printing character in your wc_npr_filter_email() function
   where shown with the X:
    c_npr_filter_email( $address_fields ) {  X $address_fields[‘
   billi If you paste the code in Notepad you should see it. Get the code to validate
   with: [http://phpcodechecker.com/](http://phpcodechecker.com/)

Viewing 1 replies (of 1 total)

The topic ‘Customizing Checkout PHP Errors’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Peter Lawrenson](https://wordpress.org/support/users/lorro/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/customizing-checkout-php-errors/#post-6837690)
 * Status: not resolved