WooCommerce Always Include Shipping Information on Checkout Page

The other day I received this question from a WooCommerce user:

I have virtual products in my store but I still want to collect the shipping information from my customers so that I can mail them a card at the end of the year. But a cart with virtual products automatically hides the shipping information on the checkout page. How can I force it to show up?

Hiding Shipping Fields When Appropriate

Now WooCommerce does this for good reason. The vast majority of stores which sell digital goods don't need the shipping information. And the user doesn't want to enter that information either. So if WooCommerce detects that a cart only has digital goods in it it will hide the shipping information.

Always Show Shipping Fields

If you want someone to enter their shipping information there's a handy little snippet you can add to your theme's functions.php file.


<?php
add_filter( 'woocommerce_cart_needs_shipping', '__return_true' );

view raw

functions.php

hosted with ❤ by GitHub

From a user experience perspective this doesn't add that much weight. Most themes don't force the user to enter shipping information they just give them the option.

Ship to Different Address

How Storefront let's users add a shipping address. It doesn't show the shipping information at all until this box is checked.

So if you want a users shipping address for any reason such as gift cards in the holiday season or something else there is a very easy way to do it. And it doesn't add much complexity so your users will still be able to checkout just as fast.

Happy shipping!

One thought on “WooCommerce Always Include Shipping Information on Checkout Page

  1. Thanks for this awesome solution Patrick!

    Only problem I noticed is that since WooCommerce brings up the Shipping/Delivery Option, it then returns an error saying “No shipping methods available” and you can’t checkout!

    Any idea how to get around that?

    Kind regards
    Jacob

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.