WPSlash

Set Default Values to WooCommerce Checkout Fields and Hide Them

All of our customers asking us how to remove some fields from WooCommerce checkout form when using WooFood or even if you are not using it.

Because WooFood need these fields (like City and Postal Code to be able to calculate the distance between the customer and the store) we decided to write this small tutorial .

Instead of using unset  to remove the fields we will set default values to the fields we want and we will hide them via CSS.

First Step is to Set the Default values we want to our checkout fields

Let’s say that we want to set a default city and a postal code. Here is a small snippet that will do the job easily.

Just copy and paste the following code into the functions.php file inside your child theme or your main theme and change the values to yours.

add_filter( 'woocommerce_checkout_fields', 'woofood_set_default_checkout_field_values' );

function woofood_set_default_checkout_field_values($fields) {
    $fields['billing']['billing_city']['default'] = 'New York';
    $fields['billing']['billing_postcode']['default'] = '10002';

    return $fields;
}

The first part is done as you have set the default values to Billing City and Billing Postal Code.

Second Step is to hide these fields from checkout page

Copy and paste the following code into style.css of your child theme or use the customiser (Appearance > Customize > Additional CSS(on the bottom)) .

#billing_city_field
{
	display:none!important;
}
#billing_postcode_field
{
	display:none!important;
}

*Note: Don’t forget to clear your browser cache and your site cache(if you are using any caching plugin)

You are ready! Now the fields will be hidden on checkout and will always have the default city and postal code you specified above

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Articles

Tutorials

How to Speed Up Your WooCommerce Restaurant Ordering Site for Peak Hours: Complete Performance Optimization Guide (Caching, Database Tuning, and CDN Setup)

Why Restaurant Ordering Sites Crash During Peak Hours (And What Makes Them Different from Regular WooCommerce Stores) It’s 6:47 PM on a Friday. Your restaurant’s online ordering system just got shared on a local Facebook group, and suddenly 200 people are trying to place dinner orders at the same time. The site slows to a […]
March 30, 2026
Tutorials

How to Configure Allergen Disclosures, Tax Rules, and ADA Accessibility Compliance for Your WooCommerce Restaurant Ordering Website (Complete Legal Compliance Guide)

Why Legal Compliance Matters for Online Restaurant Ordering Sites Running a restaurant website isn’t just about beautiful food photos and a smooth checkout. The moment you accept orders online, you step into a regulatory landscape that spans food safety law, tax code, disability rights, and data privacy — often simultaneously. And the consequences of getting […]
March 30, 2026
Tutorials

How to Manage Restaurant Inventory and Track Stock Levels with WooCommerce: A Complete Guide to Reducing Food Waste and Avoiding Sold-Out Menu Items

Why Inventory Management Matters for Restaurants Using WooCommerce A restaurant running out of its most popular dish during a Friday dinner rush isn’t just an inconvenience — it’s a direct hit to revenue and customer trust. Unlike a clothing store where unsold stock sits on shelves for months, restaurants deal with ingredients that spoil in […]
March 30, 2026