• Resolved Deepak

    (@d88pak)


    Hi Team,

    I used the following code to make Email field optional

    function make_email_optional_on_checkout_page($fields)
    {
        $fields['billing_email']['required'] = false;
        return $fields;
    }
    
    add_filter('woocommerce_billing_fields', 'make_email_optional_on_checkout_page', 1000, 1);

    However, i am still getting this error message when I click on Confirm Order button.

    Please provide a valid email address. 

    How can make this field optional?

    I have updated my WordPress to 6.4.1

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Ahir Hemant

    (@hemant-ahir)

    The guest billing email is required by WooCommerce email notifications system, so you can’t really make it optional in an easy way.

    Hi @d88pak

    Thanks for reaching out!

    I understand that you are using the custom code snippet above to make the email address field optional on your site’s checkout page, however, it is not working as expected.

    As mentioned by @hemant-ahir, the system uses the email address to send the order confirmations and updates.

    However, if you still want to proceed with making it optional, it would need some customization to address. Unfortunately, custom coding is not something we can assist with directly. However, I’ll keep this thread open for a bit to see if anyone from the community can lend a hand.

    If you have any other questions related to development or custom coding, don’t hesitate to reach out to some of the great resources we have available for support. The WooCommerce community is filled with talented open-source developers, and many of them are active on the channels listed below:

    Hope this helps!

    Thread Starter Deepak

    (@d88pak)

    Hi Team,

    I have used the above snippet and enabled the guest checkout from the WooCommerce setting. It is working fine now.

    Thanks!

    Plugin Support Beauty of Code (woo-hc)

    (@beautyofcode)

    Hey @d88pak ,

    I’m really glad to hear that you managed to achieve your desired results here!

    I’ll go ahead and mark this as resolved then, however feel free to?create a new topic?if you need any further help with WooCommerce core ??

    Have a great day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Making Checkout Page Email Optional Not Working’ is closed to new replies.