Make “Phone Number” field non-mandatory on WooCommerce checkout page

By default, “Phone number” textbox is required field in WooCommerce checkout page and user cannot place order without filling it out. But sometimes, people don’t like to provide their contact number. Hence you may like to make it non-compulsory field.

Quick Tip : Change The PayPal Icon In WooCommerce

To do this, simply add the following WordPress code snippet in your functions.php file located inside your theme directory.

//Make Phone Number field non-mandatory on WooCommerce checkout page
add_filter( 'woocommerce_billing_fields', 'wc_npr_filter_phone', 10, 1 );
function wc_npr_filter_phone( $address_fields ) {
    $address_fields['billing_phone']['required'] = false;
    return $address_fields;
}

 

0 Comments

Leave a Comment.