How to reduce items on WooCommerce checkout page

adriandra karuniawan HHT djrUzM unsplash scaled Woocommerce
This article can be read in about 3 minutes.

I will show you how to delete unnecessary items on the WooCommerce checkout page. Just put the following code in your theme’s functions.php and save/update. By entering this, all input other than first name, last name, company name (optional), and email address will be deleted. This is ideal if you are selling virtual products. Please feel free to adjust any items you need.

// Remove billing details from woocommerce checkout field
              add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
              function custom_override_checkout_fields( $fields ) {
                          unset($fields['order']['order_comments']);
                          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_address_2']);
                          unset($fields['billing']['billing_postcode']);
                          unset($fields['billing']['billing_city']);
                          return $fields;
                      }
              add_filter('woocommerce_enable_order_notes_field', '__return_false');

Comment

Donate with Cryptocurrency!

Copied title and URL