- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
WooCommerce. How to remove checkout fields
September 28, 2015
This tutorial shows you how to remove checkout fields in a WooCommerce store.
WooCommerce. How to remove checkout fieldsDefault WooCommerce checkout form comes with several fields for customers to enter their billing details. But in some cases, you might want to hide some of these fields. For example, if you are selling only virtual products, you can get rid of fields like billing address:
In order to remove checkout fields, you need to perform the following:
-
Open up the wp-content/themes/themeXXXXX/includes/custom-function.php file. You may need to download it to your local system if you are using FTP, or you can access the file directly through your hosting file manager.
-
Scroll down to the very end of the file and add the following code there:
<?php add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { return $fields; } ?>
-
Choose the fields to be removed from the list below and insert the corresponding code inside the custom_override_checkout_fields function before the return statement.
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['order']['order_comments']); unset($fields['billing']['billing_email']); unset($fields['account']['account_username']); unset($fields['account']['account_password']); unset($fields['account']['account_password-2']);
-
Save the changes in the wp-content/themes/themeXXXXX/includes/custom-function.php file and upload it to the server. Reload the page. The fields chosen to be unset are removed from the checkout page:
Feel free to check the detailed video tutorial below:
WooCommerce. How to remove checkout fields