I'm working on a WooCommerce project and my client wants Billing Email Optional not Mandatory in checkout page. I've did this following steps but did not get any result.
class-wc-countries.php (did not work)
$address_fields['billing_email'] = array(
'label' => __( 'Email address', 'woocommerce' ),
'required' => false, //default was TRUE
'type' => 'email',
'class' => array( 'form-row-wide' ),
'validate' => false, // default was array( 'email' )
'autocomplete' => 'no' === get_option( 'woocommerce_registration_generate_username' ) ? 'email' : 'email username',
'priority' => 110,
);
also add this line of code in my child theme function.php (did not work)
add_filter( 'woocommerce_checkout_fields', 'misha_no_email_validation' );
function misha_no_email_validation( $fields ){
$fields['billing']['billing_email']['required'] = false;
unset( $fields['billing']['billing_email']['validate'] );
return $fields;
}
then use 2 plugin Checkout Field Editor for WooCommerce and Flexible Checkout Fields but did not get any result.
Please help!!
Thanks.