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 Set Up SMS and WhatsApp Order Notifications for Your WooCommerce Restaurant (2026)

Why SMS and WhatsApp Notifications Matter for Restaurant Orders A customer places an order on your <a href="https://www.wpslash.com/how-to-set-up-real-time-order-tracking-for-your-woocommerce-restaurant-website-2025-2/" title="How to Set Up Real-Time Order Tracking for Your <a href="https://www.wpslash.com/how-to-set-up-catering-and-large-group-orders-on-your-woocommerce-restaurant-website-2025/" title="How to Set Up Catering and Large Group Orders on Your WooCommerce Restaurant Website (2025)”>WooCommerce Restaurant Website (2025)”>restaurant website at 7:15 PM during the Friday rush. […]
May 3, 2026
Tutorials

How to Set Up Real-Time Order Tracking for Your WooCommerce Restaurant Website (2026)

Why Real-Time Order Tracking Matters for Restaurant Websites Picture this: a hungry customer places an order on your <a href="https://www.wpslash.com/how-to-build-a-customer-loyalty-program-for-your-wordpress-restaurant-website-2025/" title="How to Build a Customer Loyalty Program for Your <a href="https://www.wpslash.com/how-to-connect-your-wordpress-restaurant-website-to-doordash-uber-eats-grubhub-2025/" title="How to Connect Your WordPress <a href="https://www.wpslash.com/how-to-rank-your-restaurant-website-on-google-local-seo-for-wordpress-2025/" title="How to Rank Your Restaurant Website on Google: Local SEO for WordPress (2025)”>Restaurant Website to DoorDash, Uber […]
May 3, 2026
Tutorials

How to Set Up Catering and Large Group Orders on Your WooCommerce Restaurant Website (2026)

Why Catering and Large Group Orders Matter for Restaurant Revenue Most restaurant owners pour energy into optimizing their dine-in experience and individual delivery orders while overlooking a revenue channel that can transform their bottom line: catering. A single corporate lunch order for 30 people can equal what your dining room generates in an entire slow […]
May 2, 2026