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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|add_filter( 'woocommerce_cart_needs_shipping', '__return_true' );|
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.
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.
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?