54

How to Remove Fields from WooCommerce Checkout Page

Powered by WPCodeBox

Learn how to easily remove unnecessary fields from your WooCommerce checkout page with this simple code snippet.


/**
 * Author: WP Turned UP
 * Author URI: https://wpturnedup.com
 */

//// 1.Clear out any lines that start with 'unset' for the corresponding items you would like to still show on your Checkout page.

----------------- CODE SNIPPET IS BELOW THIS LINE - REMOVE THIS LINE AND ABOVE ----------------- 

//Remove Fields from WooCommerce Checkout
add_filter( 'woocommerce_checkout_fields' , 'mlc_remove_checkout_fields' ); 

function mlc_remove_checkout_fields( $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['order']['order_comments']);
unset($fields['billing']['billing_email']);
unset($fields['account']['account_username']);
unset($fields['account']['account_password']);
unset($fields['account']['account_password-2']); 

return $fields; 

}

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.