WPSlash

Set Default Values to WooCommerce Checkout Fields and Hide Them

Saturday November 2, 2019

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

Restaurants Tutorials

The Cheapest Food Delivery App for Restaurants Isn’t an App at All — It’s WooFood

When restaurant owners start looking for the cheapest food delivery app, they quickly discover a frustrating truth: most “cheap” delivery platforms aren’t cheap at all. They either take commissions, charge high monthly fees, lock you into their payment processors, or limit how much control you have over your own customer base. But what if the […]
December 1, 2025
Restaurants WooFood

Why “Free” GloriaFood Might Not Be The Best Long-Term Bet For Your Restaurant

When you’re building an online ordering system for your restaurant, it’s tempting to go for a “free” solution. That’s exactly what GloriaFood offers: a ready-to-go, easy-to-install WordPress plugin for online ordering, delivery, and reservations with no setup fees or commissions But “free” doesn’t always mean “best,” especially when you’re serious about owning your brand, your […]
December 1, 2025
Tutorials WooCommerce

How to Choose the Best Food Ordering System for Your Restaurant (And Why WooFood is the Ultimate Solution)

If you’re running a restaurant, café, or fast-food business in today’s digital age, offering online food ordering is no longer optional — it’s essential. Customers expect the convenience of browsing your menu, customizing their orders, and checking out seamlessly from their phone or computer. But with so many plugins and systems available, how do you choose the right […]
April 21, 2025