Disable Billing Address

9 months ago

< 1 min read

Posted by:

Focus

Subscribe to newsletter

By subscribing you agree to with our Privacy Policy.

Share

Simplify checkout for virtual products or order via WhatsApp. Add this code in function.php.

CODE PHP

/**
 * @snippet Simplify Checkout if Only Virtual Products
*/

add_filter( 'woocommerce_checkout_fields' , 'njengah_simplify_checkout_virtual' );

function njengah_simplify_checkout_virtual( $fields ) {

   $only_virtual = true;

   foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {

      // Check if there are non-virtual products
      if ( ! $cart_item['data']->is_virtual() ) $only_virtual = false;
   }

    if( $only_virtual ) {

       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']);

       add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );

     }
     return $fields;

}

Read more

Troubleshoot

< 1 min read

How to Fix Custom Fields Not Showing in WordPress (Crash with ACF Plugin)

If custom field is not showing when ACF plugin is activated, go to Dashboard > Themes > Themes File Editor,

Read more

Troubleshoot

< 1 min read

How to Fix Critical Error when Adding a New Site on WordPress Multisite

If you have ‘Delete Duplicate Posts’ plugin, deadactivate it, and then see if that fixes the problem. Otherwise, try to deadactivate all

Read more

Single Post

< 1 min read

Enhance WordPress Buttons

Optimize your WordPress site with these CSS tweaks. Elevate button aesthetics and code block readability for a better user experience

Read more

Header

< 1 min read

Change Color of Header and Show-Hide Elements On Scroll

Useful for transparent headers. IMPORTANT Under ‘Motion Effect’ settings, below ‘Offset’, you must set the ‘Effects Offset’ into ‘1’ or larger. Otherwise, the CSS won’t

Read more

See How It Works

Create better websites, faster.

Download the Entire Library

Adaptative, neutrally designed components.

Customer Service

Focus Website

Today, July 27

Hi, there 👋

How can I help you?

Start Chat with:

We use cookie to improve your experience on our site. By using our site you consent cookies.