Depending on the type of products you are selling via a Woocommerce store, sometimes you don’t need the billing and shipping address details on the Woocommerce checkout page. Adding this little snippet to your functions.php file, you can deregister them from loading easily:
add_action('woocommerce_checkout_init','disable_billing_shipping');
function disable_billing_shipping($checkout){
$checkout->checkout_fields['billing']=array();
$checkout->checkout_fields['shipping']=array();
return $checkout;
}
Is there any way to do this that the shipping address is left of a customer processing email for certain product or just in general?
Thanks
I did like this:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
unset($fields['shipping']);
}
If you even remove
unset($fields[‘shipping’]);
it will also works
Ah. I see now why you did as you did. Else you get php warning. 🙂
is there a way that woocommerce will not store any shipping and billing details in the database at it consumes space.
Hmm, not sure. If you mark a product as Virtual or Downloadble, it removes the address collection for shipping as no shipping method is needed. Not sure WooCommerce supports not saving any address on all products without some core plugin hacking.
Hi, it seem to not work anymore with new Woocommerce version or maybe with new WordPress version 4.4
Hi Gino,
This works for me still (tested). I am also using WordPress 4.4 and the latest version of WooCommerce. Are you adding this code to the correct place? Should either be in functions.php or in a custom plugin you created. I just added it to my own site and it removed the billing and shipping fields from my checkout. Hope this helps. 🙂
thanks for your guide
Thanks man.. This little snippet did the trick what special plugin for this and all unset fields code didn’t able to do..
Thank you for your guide.
Is there a way that only Address Field is open and all other fields like Town, State are removed or predefined?
I just deliver food within block of offices so they just have to tell me their unit number.
Thank you
I’d recommend possibly using WooCommerce’s plugin for this, https://woocommerce.com/products/woocommerce-checkout-field-editor/
Hello Phil.
Great article. I made a plugin that do the same. You can disable/rearrange content inside the single product page and shop page. Also, you can remove checkout fields. I uploaded it to wordpress, so here you have the link WooEnhacer – WooCommerce Customizer if someone is interested.
Can you please let me know what the easiest way to hide my bank details on order-received page? I want my bank account details sent only via emails.