I am using WooCommerce membership for one product and the rest of the WooCommerce products are generic products.
I use this code for this topic
I use this code to customize the email on the WooCommerce checkout page. How can I specify that if a product needs to be registered, email will be required?
add_filter( 'woocommerce_billing_fields', 'ts_unrequire_wc_email_field');
function ts_unrequire_wc_email_field( $fields ) {
$fields['billing_email']['required'] = false;
return $fields;
}
2
Answers
I want the email to be required when one of the products needs to be registered using this code:
And in other cases where the product can be purchased as a guest, email is not required.
Try This: