/

Remove fields from WooCommerce checkout page

WRITTEN BY :
Aless Design Studio
POSTED ON :
07/10/2021
TAGS :

Table of Contents

These days having an online business is necessary more than ever. The way we learn, buy, sell and find services we need has changed drastically in the last few years, especially since Covid-19 came to the world.

Your online store or business website is the fastest and easiest way to communicate with your clients or sell your products. That’s why you need to consider making your website the best for your audience.

Why is useful to know how to remove fields from WooCommerce checkout page?

WooCoomerce is probably one of the most popular e-commerce solutions for WordPress today. According to statistics from 2021 a total of 3,876,748 websites use WooCommerce. That is really huge!

If you choose to build your e-commerce website with this plugin, this post may be very helpful to you. Even though WooCommerce is mostly used for selling physical products, it is capable to sell virtual ones like e-books, printables, and even online courses.

That’s why removing some of the fields from the checkout page is very useful to have as knowledge. Sometimes is just necessary. This is probably the most important page on your website and you don’t want any distractions for your clients.

Default WooCommerce Checkout Page

Remove fields from WooCommerce checkout page

How to remove fields from WooCommerce page?

In this method, we will see how to remove fields from WooCommerce checkout page using code. In the code below you can see the list of all fields. If you use the whole code you will remove all WooCommerce fields. 

According to your needs delete the line of code for the fields you need to keep at your checkout page.

Remove all fields from checkout

This code removes all fields from the checkout page. 

				
					add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
 
function custom_remove_woo_checkout_fields( $fields ) {

    // remove billing fields
    unset($fields['billing']['billing_first_name']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_country']);
    unset($fields['billing']['billing_state']);
    unset($fields['billing']['billing_phone']);
    unset($fields['billing']['billing_email']);
   
    // remove shipping fields 
    unset($fields['shipping']['shipping_first_name']);    
    unset($fields['shipping']['shipping_last_name']);  
    unset($fields['shipping']['shipping_company']);
    unset($fields['shipping']['shipping_address_1']);
    unset($fields['shipping']['shipping_address_2']);
    unset($fields['shipping']['shipping_city']);
    unset($fields['shipping']['shipping_postcode']);
    unset($fields['shipping']['shipping_country']);
    unset($fields['shipping']['shipping_state']);
    
    // remove order comment fields
    unset($fields['order']['order_comments']);
    
    return $fields;
}
				
			

Adding the code

When you decide which fields you want to keep for your checkout page, delete the lines from the code above (the lines which remain here will be deleted on the front-end), it is time to put it on your website.

Go to Appearance > Theme Editor > functions.php

Example code:

				
					add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
 
function custom_remove_woo_checkout_fields( $fields ) {

    // remove billing fields
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_state']);

    // remove shipping fields 
 
    unset($fields['shipping']['shipping_address_1']);
    unset($fields['shipping']['shipping_address_2']);
    unset($fields['shipping']['shipping_city']);
    unset($fields['shipping']['shipping_postcode']);
    unset($fields['shipping']['shipping_state']);
    
    // remove order comment fields
    unset($fields['order']['order_comments']);
    
    return $fields;
}
				
			

In this scenario, at the checkout page, we have fields only for:

  • Name
  • Country
  • Phone
  • Email address

That’s it! It may seem very complicated, but when you do it a few times you will master it! Now you know how to remove what you don’t need and what to keep.

Pro tip: whenever you make such a big change with your WooCommere core, make sure to have a backup of your website. Sometimes mistakes happen and it is very useful to have a quick and easy fix!

 1,727 total views,  1 views today

Leave a Reply

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

Related Posts.

WordPress 5.9
WordPress

WordPress 5.9 Big Update & Big Changes

WordPress 5.9 is the first major release of 2022, as it was launched on January 25, 2022. This recent version brings new features and enhancements that make full site customization even easier.

 1,743 total views,  2 views today

Read More »
WRITTEN BY :
Aless Design Studio
POSTED ON :
07/10/2021
TAGS :

Table of Contents

These days having an online business is necessary more than ever. The way we learn, buy, sell and find services we need has changed drastically in the last few years, especially since Covid-19 came to the world.

Your online store or business website is the fastest and easiest way to communicate with your clients or sell your products. That’s why you need to consider making your website the best for your audience.

Why is useful to know how to remove fields from WooCommerce checkout page?

WooCoomerce is probably one of the most popular e-commerce solutions for WordPress today. According to statistics from 2021 a total of 3,876,748 websites use WooCommerce. That is really huge!

If you choose to build your e-commerce website with this plugin, this post may be very helpful to you. Even though WooCommerce is mostly used for selling physical products, it is capable to sell virtual ones like e-books, printables, and even online courses.

That’s why removing some of the fields from the checkout page is very useful to have as knowledge. Sometimes is just necessary. This is probably the most important page on your website and you don’t want any distractions for your clients.

Default WooCommerce Checkout Page

Remove fields from WooCommerce checkout page

How to remove fields from WooCommerce page?

In this method, we will see how to remove fields from WooCommerce checkout page using code. In the code below you can see the list of all fields. If you use the whole code you will remove all WooCommerce fields. 

According to your needs delete the line of code for the fields you need to keep at your checkout page.

Remove all fields from checkout

This code removes all fields from the checkout page. 

				
					add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
 
function custom_remove_woo_checkout_fields( $fields ) {

    // remove billing fields
    unset($fields['billing']['billing_first_name']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_country']);
    unset($fields['billing']['billing_state']);
    unset($fields['billing']['billing_phone']);
    unset($fields['billing']['billing_email']);
   
    // remove shipping fields 
    unset($fields['shipping']['shipping_first_name']);    
    unset($fields['shipping']['shipping_last_name']);  
    unset($fields['shipping']['shipping_company']);
    unset($fields['shipping']['shipping_address_1']);
    unset($fields['shipping']['shipping_address_2']);
    unset($fields['shipping']['shipping_city']);
    unset($fields['shipping']['shipping_postcode']);
    unset($fields['shipping']['shipping_country']);
    unset($fields['shipping']['shipping_state']);
    
    // remove order comment fields
    unset($fields['order']['order_comments']);
    
    return $fields;
}
				
			

Adding the code

When you decide which fields you want to keep for your checkout page, delete the lines from the code above (the lines which remain here will be deleted on the front-end), it is time to put it on your website.

Go to Appearance > Theme Editor > functions.php

Example code:

				
					add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
 
function custom_remove_woo_checkout_fields( $fields ) {

    // remove billing fields
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_state']);

    // remove shipping fields 
 
    unset($fields['shipping']['shipping_address_1']);
    unset($fields['shipping']['shipping_address_2']);
    unset($fields['shipping']['shipping_city']);
    unset($fields['shipping']['shipping_postcode']);
    unset($fields['shipping']['shipping_state']);
    
    // remove order comment fields
    unset($fields['order']['order_comments']);
    
    return $fields;
}
				
			

In this scenario, at the checkout page, we have fields only for:

  • Name
  • Country
  • Phone
  • Email address

That’s it! It may seem very complicated, but when you do it a few times you will master it! Now you know how to remove what you don’t need and what to keep.

Pro tip: whenever you make such a big change with your WooCommere core, make sure to have a backup of your website. Sometimes mistakes happen and it is very useful to have a quick and easy fix!

 1,728 total views,  2 views today

Leave a Reply

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

Related Posts.

WordPress 5.9
WordPress

WordPress 5.9 Big Update & Big Changes

WordPress 5.9 is the first major release of 2022, as it was launched on January 25, 2022. This recent version brings new features and enhancements that make full site customization even easier.

 1,743 total views,  2 views today

Read More »