How to Remove Checkout Fields from Woo-commerce Checkout page How to Remove Checkout Fields from Woo-commerce Checkout page
February 17, 2025

How to Remove Checkout Fields from Woo-commerce Checkout page

With the growing demands of eCommerce, businesses increasingly require customized checkout pages designed to their specific needs. One such challenge was recently addressed by the team at XenelSoft Technologies when we were tasked with simplifying the WooCommerce checkout page to align with a client’s unique requirements.
A client approached us with a specific requirement: to simplify the WooCommerce checkout form by displaying only the NameEmail, and Phone Number fields, along with a “Get Pricing” button. The task was to remove mandatory fields such as Shipping AddressBilling AddressCountryStatePostcode, and Last Name, while making the Phone Number field mandatory, which is optional by default in WooCommerce. This setup would allow the client to send price details at a later stage.

Initially, the team tried modifying the WooCommerce plugin’s checkout form file and experimented with several solutions from forums and online communities.Various methods, including setting the fields as “not required” in the functions.php file and using plugins like WooCommerce Direct Checkout and Checkout Field Editor, were tried. However, these approaches did not achieve the desired results.

Here is the code that internet was flooded with:

function custom_disable_postcode_checkout($fields) {

    unset($fields[‘billing’][‘billing_postcode’]);

    unset($fields[‘shipping’][‘shipping_postcode’]);

    return $fields;

}

add_filter(‘woocommerce_checkout_fields’, ‘custom_disable_postcode_checkout’);

Unfortunately, this method no longer works with the latest updates.

After further investigation, it became clear that the latest version of WordPress utilizes a block-based structure for WooCommerce pages, replacing the previous file-based approach. With this insight, we were able to implement the solution by adding a specific code to the functions.php file, “This modification successfully adjusted the checkout form fields to meet the client’s requirements. The code was customized for the Canadian market, as the client operates in Canada, but it can be adapted for any country based on specific needs.

Many users face similar challenges and often resort to purchasing premium plugins for solutions. However, with the right approach, such issues can be resolved without additional costs.

Here’s how the solution was implemented:

add_filter(‘woocommerce_get_country_locale’, function( $locale ) {

$locale[‘CA’][‘first_name’][‘label’]=’Name’; 

$locale[‘CA’][‘last_name’][‘required’] = false;

$locale[‘CA’][‘last_name’][‘hidden’] = true;

$locale[‘CA’][‘state’][‘required’] = false;

$locale[‘CA’][‘state’][‘hidden’] = true;   

$locale[‘CA’][‘address_1’][‘required’] = false;

$locale[‘CA’][‘address_1’][‘hidden’] = true;

$locale[‘CA’][‘postcode’][‘required’] = false;

$locale[‘CA’][‘postcode’][‘hidden’] = true;

$locale[‘CA’][‘city’][‘required’] = false;

$locale[‘CA’][‘city’][‘hidden’] = true; 

// Making the phone number field required

$locale[‘CA’][‘phone’][‘required’] = true;    

 // Removing the “optional” text from the placeholder

$locale[‘CA’][‘phone’][‘placeholder’] = ”;

return $locale;

});

This code can be added to the functions.php file to simplify the checkout process for WooCommerce users.

Stay tuned for more insights on WordPress and WooCommerce development!

Need help with your WordPress or WooCommerce projects?

At XenelSoft Technologies, we specialize in providing customized eCommerce solutions. Connect with us today to discuss how we can help optimize your online business.


Nalini Tomar
Founder and Managing Director

We’re Just One Click Away

Send us your details, and we’ll offer the support you need.

Full Name must be 2 to 70 characters long and contain only alphabets and spaces.
Please enter a valid Email ID.
Please enter a valid Mobile number only digits.
Budget is required.
Please select a Service.
Please select a Country.

XenelSoft Worldwide Presence

As a leading digital solutions company, XenelSoft operates globally, delivering services from multiple locations around the world.

india
India
location
Corporate Office :
B-79, First floor, Sector-63, Noida-201301, India.
location
+91-9319255992
Singapore
Singapore
location
Office :
11 Woodlands Close, #03-35 Woodlands 11,Singapore (737853)
united KINGDOM
UNITED KINGDOM
location
Office :
70 Manning Road, BS4 1FL, Bristol, United Kingdom
location
+44 7587 302086
canada
CANADA
location
Office :
4380 south service road unit 14 Burlington ON
Telephone
+1 (917) 636 5837
build_img build_img

Be the First to Know –
Join Us

Join a community that values knowledge and growth—subscribe today.
hand image