Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13408

    Hi,

    I have been trying to make the telephone number check out field in WooCommerce not-required. I am still learning about hooks and filters, and I am having trouble understanding which of the following functions to use, and where to put it in the code. I think the first one would remove the billing phone number, and the second one would just make it non-required. Can you please let me know in which file/directory I should place this code, and if there are any brackets, tags, etc that I should next them in?

    add_filter(‘woocommerce_billing_fields’, ‘custom_woocommerce_billing_fields’);

    function custom_woocommerce_billing_fields( $fields_array ) {

    unset($fields_array);

    return $fields_array;

    }


    add_filter(‘woocommerce_billing_fields’, ‘custom_woocommerce_billing_fields’);

    function custom_woocommerce_billing_fields( $fields_array ) {

    $fields_array = false;

    return $fields_array;

    }

    Thanks!

    #79124

    Hi!

    Please add it to the bottom of functions.php.

    Regards,

    Peter

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Using Filter to Make Phone Number Optional’ is closed to new replies.