Remove WooCommerce Checkout Fields | Code For Developers

Remove WooCommerce checkout fields

Remove WooCommerce Checkout field with simple filter hook

Woocommerce has a lot of field in billing and shipping details. you can use a plugin to add or remove woocommerce checkout fields, it but some people like me try to not use the plugin as much as possible time.

So, let just put the code on your functions.php and comment or remove those line that you need to show on woocommerce checkout page. For example, I activate the email field by comment out unset($fields[‘billing’][‘billing_email’]);

theme functions.php
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;
}

It just simple woocommerce filter hook that work great. Any question comment below, Enjoy 😍

Previous Code

WooCommerce Checkout Conflict with Bootstrap 4.x

WooCommerce Checkout Conflict with Bootstrap 4.x. ...

Next Code

File manager for any website

You can install a File manager for any website you ...

Leave a Reply

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

If you find it useful

Buy me a coffee

ACF

Elementor

JavaScript

jQuery

Others

PHP

WooCommerce

WordPress

WP Plugin Dev

WooCommerce Ajax Product Search and Category Filter Without Plugin

WooCommerce Ajax Product Search with Category Filt ...

How to Implement Google Ads Conversion Tracking in WooCommerce

Learn how to add Google Ads tracking code to your ...

Add an additional custom checkbox in the WooCommerce checkout

Add an additional custom checkbox after the terms ...

Making Specific Products Unpurchasable or purchasable for a specific date in WooCommerce

How to make specific products not purchasable in W ...

WooCommerce Checkout Conflict with Bootstrap 4.x

WooCommerce Checkout Conflict with Bootstrap 4.x. ...

top