AI Verified

Name

WooCommerce Remove Checkout Fields

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

MyCloudWorld

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.0.2

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://mycloudworld.com

History

Last modified:

13/11/2022

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

WooCommerce Remove Checkout Fields

 
                    
1add_filter( 'woocommerce_checkout_fields' , 'mcw_remove_woocommerce_checkout_fields' );
2function mcw_remove_woocommerce_checkout_fields( $fields ) {
3 
4 // remove any billing field using unset
5 unset($fields['billing']['billing_first_name']);
6 unset($fields['billing']['billing_last_name']);
7 unset($fields['billing']['billing_company']);
8 unset($fields['billing']['billing_address_1']);
9 unset($fields['billing']['billing_address_2']);
10 unset($fields['billing']['billing_city']);
11 unset($fields['billing']['billing_postcode']);
12 unset($fields['billing']['billing_country']);
13 unset($fields['billing']['billing_state']);
14 unset($fields['billing']['billing_phone']);
15 // unset($fields['billing']['billing_email']);
16 
17 // remove any shipping fields by unset it
18 unset($fields['shipping']['shipping_first_name']);
19 unset($fields['shipping']['shipping_last_name']);
20 unset($fields['shipping']['shipping_company']);
21 unset($fields['shipping']['shipping_address_1']);
22 unset($fields['shipping']['shipping_address_2']);
23 unset($fields['shipping']['shipping_city']);
24 unset($fields['shipping']['shipping_postcode']);
25 unset($fields['shipping']['shipping_country']);
26 unset($fields['shipping']['shipping_state']);
27 
28 return $fields;
29}

0

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

Woo Dodaj nesto iza cene

Added: 1 year ago

Last Updated: 1 year ago

WooCommerce

AI Verified

0

WooCommerce Add A Fee At Checkout Based On The Postcode Entered

Added: 1 year ago

Last Updated: 1 year ago

You may wish to charge an additional fee based on the user’s postcode. This solution shows how you can add a £5 fee (the currency will be whatever you have set it in your WooCommerce Settings) dependi...

WooCommerce

AI Verified

0

Inventory Status Change

Added: 5 months ago

Last Updated: 5 months ago

I have a client who sells logs - has less than 10 products and doesn't use the stock management tools in WooCommerce. They wanted to control the Inventory on the basis of 'In Stock' or 'Out of Stock'...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

General

AI Verified

5

Remove Google Fonts and Use System Fonts

Added: 1 year ago

Last Updated: 1 month ago

Use this hook to remove all Google Fonts from website and use system fonts for best CLS Score.

WooCommerce

AI Verified

4

WooCommerce Hide Coupon Form after apply

Added: 1 year ago

Last Updated: 10 months ago

WooCommerce hide coupon form after coupon is applied.

WordPress Admin

AI Verified

2

Image Size Upload Set To Full Default

Added: 1 year ago

Last Updated: 9 months ago

If you want to set the image size to full-width for use in the post editor permanently.