Compulsory WooCommerce Billing Fields

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.


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;
Article published 19th March 2020
Last modified 02nd November 2023