»  Knowledgebase  »  WooCommerce  »  Compulsory WooCommerce Billing Fields

Compulsory WooCommerce Billing Fields

by | Mar 19, 2020 | 0 comments

To make WooCommerce Billing fields compulsory, the following code can be added to functions.php in your childtheme. Please note unless you are experienced with php, you should proceed with caution as an incorrect installation can render your website inoperable.

Code

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

0 Comments

Submit a Comment

Your email address will not be published.

UK WordPress Support

We are a team of UK based WordPress experts offering WordPress help & support, WordPress site management and maintenance, content management services, one to one WordPress training and consultancy.

Need to chat? Contact Us Now!

WordPress Maintenance

Let us manage your plugin and theme updates, keep your WordPress website site running smoothly and your visitors happy!

WordPress Care Plans
from just £35 / month!

One to One WordPress Training

We provide one to one WordPress training to individuals and companies all over the World!

Whether you are developing new skills for business or working on a personal project, we can support you, and your first trial session is free!

Book an initial WordPress Orientation Session

Get the WordPress Management Guide

Get the WordPress Management Guide

Sign up to our newsletter to receive our insider guide to managing WordPress in [currentyear], free to your inbox.

You have Successfully Subscribed!