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)
//
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 .= ‘
The topic ‘Customizing Checkout PHP Errors’ is closed to new replies.