Do you want to make some checkout fields not required such as phone number or the first name? Use this snippet below to do this.
In the above we are making the billing first name, last name, phone number, email and country as not required.
To add more you need to just add the HTML names of the fields. You can use inspect to check the names on the checkout page. For your reference we have added them below.
Likewise you can change the text “false” to be “true” to make them required.
Billing Fields
- billing_first_name
- billing_last_name
- billing_company
- billing_country
- billing_address_1
- billing_address_2
- billing_city
- billing_state
- billing_postcode
- billing_phone
- billing_email
Shipping Fields
- shipping_first_name
- shipping_last_name
- shipping_company
- shipping_country
- shipping_address_1
- shipping_address_2
- shipping_city
- shipping_state
- shipping_postcode
Order Fields
- order_comments
Where do I add this code? Do I upload a new PHP file with the code or just paste it somewhere?
Please add this in your functions.php file in a child theme