You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"
Does this snippet (still) work?
Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.
Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!
Business Bloomer Founder
Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.
68 thoughts on “WooCommerce: “Ship to a Different Address” Opened by Default”
Is there a way to use this to open ship to different address for specific user roles? For example I have wholesale users that would normally send to someone else and bill to themselves so for that role having this open for that role would be useful but not for other roles.
Hi Chris, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
I am like 12 and trying to sort out a little project in wordpress – built a website and working stuff out and found this website really hope someone can help me figure how to change the size of text for DELIVER TO A DIFFERENT ADDRESS ? on my checkout page.
I got a lot of help making it work but the text is to small on checkout.
looked everywhere for the PHP code that is for this and also looked around the Theme Editor bit but just cant find where this title is in wordpress or woo.
really appreciate any help please
trying to figure out how to increase font size for that Title Label DELIVER TO DIFFERENT ADDRESS really and think Im just lost now
Thanks very much
Hi Zane, you’ll need CSS for that, and not PHP. Hope this helps!
Hello Sir !!! I was usig the snippit in reverse (was forcing it to be checked always) through my custom plugin. Worked for first three days but no longer work. I have no Idea Why, can you help please ?
Sounds like a plugin conflict to me
Stopped working for me as well for a few months now. Both in Salient and Avada theme.
Weird, works perfectly for others too
I noticed the delivery address was ticked by default and I can see others reporting the code does not work. After some messing around I found that this code prevented your code from working. in case others were using something similar. I haven’t found a way to get both working together as yet. But im not very good at coding so . . . . :/
For those, for whom these snippets didn’t work:
checkout.js compares billing and shipping fields and if they are different, it triggers click on the “Ship to a Different Address” checkbox on the page load. In my case they were different: I removed some fields in the billing part and forgot to remove them in the shipping part.
Thank you. It works.
WooCommerce at last has recognized that there is an issue with checkbox activated by default on last WooCommerce 3.9 …. so this it seems that this is not working properly .. in fact in my sites ( storefront and woo 3.9) it’s not working anymore since 3.9
Works for me on 3.9.1
Do maybe have the following plug-in installed? “Checkout Field Editor for WooCommerce”
I have the same problem. When I deactivate this plug-in the problem no longer occurs.
OOOh. I have the same issue. Lucky. NOT lucky..
This is a neat topic, but doesn’t seem to work with this other nice one :
DISPLAY CART & CHECKOUT ON SAME PAGE @ https://businessbloomer.com/?p=80321
Did you use them together in a way it worked ?
Hey Thibault, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Since the woocommerce update 3.9 this snippet no longer works. Do you know why? Or do you have another snippet to use?
Hi there, thanks for your comment! I just tested this again with Storefront theme and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet?
To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentyseventeen” theme (load the snippet there in functions.php) – does it work? If yes, you have a problem with your current theme or one of the plugins.
Hope this helps!
I have the same issue. Just upgraded to 3.9 and it stopped working.
always showing “ship to a different address” checked.
I switched to Twenty Twenty + Storefront
Not working on both. can you advice?
Works for me on 3.9.1
I want to confine shipping country in the “ship to a different address?” section based on billing country.
As an example, if a customers billing country is United States, I only want orders to be able to shipped to within the United States. The can use a different shipping address but it must be within the United States.
I want to do the same with some other countries, like Romania, Hungary etc as I need to cut down on credit card fraud.
But I want to leave other countries open, Such as Australia and New Zealand.
Is there a plug-in or a way you can code this?
Hello Charlie, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Thanks! This was exactly what I needed 🙂
Works correctly. Thank you
Still works! 😉
Whenever when I have a problem to solve, after search in google, I find you with the exactly solution! Thank you my friend!
Still works 😉
It works fine, thanks
Thanks for this – and all your tips! They have saved me much research time.
Question: Can I hide the “Ship to a Different Address” title altogether based on chosen_shipping_method? (Not just uncheck it)
I tried this code, but it throws an error: (the ‘hideshipto’ script adds CSS to hide the title)
Is there an easier way to do this? Or am I just adding to the wrong hook?
Diana, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Hi, i try using both code but nothing works out for my site. I’m using bazar theme and my checkout page still only show billing address
Hello Lea, thanks so much for your comment! I just retested this on the latest version of WooCommerce and it still works. Unfortunately this looks like custom troubleshooting work and I cannot help here via the blog comments. Thanks a lot for your understanding! ~R
Hi. Could you tell me how to swap the positions of the billing and shipping address fields around – so that shipping address is on the left and opened by default, and billing address is on the right, closed by default. Please let me know! Thank you in advance. 🙂
Hey Peter, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
hello for some reason this option “ship to a different address” disappears for logged in customers/users. Do you know how to force it to always be there?
Hey there, thanks so much for your comment! Have you tried using snippet #2?
Worked great! I added it to a custom plugin, which is my preferred method for adding quick functionality (I’m using the default Storefront theme with no child theme).
Cool, thanks Stephanie 🙂
Hi Stephanie and Rodolfo,
I cannot seem to make this code snippet work on my site by adding it to my child theme’s “functions.php” file.
Do you mind letting me know where did you add the code exactly? which plugin?
Thank you very much.
Try with the “Code Snippets” plugin, and see if that works for you 🙂
Is it also possible to entirely remove the option of shipping to a different address?
Thanks so much.
Hey Geert, thanks for your comment! You can force “shipping to billing address” in the WooCommerce settings, and then completely remove the shipping form via simple PHP if that’s what you’re asking for. Let me know!
Great, the forcing did the job. Thank you!
Last question: in Europe it’s necessary to have the VAT number for invoicing. Is it possible to add an optional field so customers can input their VAT number?
Awesome – great to hear that! Yes, of course, VAT can be added. There is an official WooCommerce premium plugin, or otherwise this can be coded pretty easily via custom PHP 🙂 Let me know!
I figured out a way Rodolfo. Thanks a lot for the support!
This was perfect. Thanks for a nice easy fix to seeing a bunch of ugly fields by default (used the closed by default version). Thank you!
Awesome, thanks for your feedback Aaron!
I was trying to add this using both my Snippets plugin and on the functions.php file of the theme (Flatsome)
It seems like nothing works and the SHIP TO A DIFFERENT ADDRESS? checkbox is still on by default.
What can be the cause of that?
I am pasting the code exactly like that, should I change something maybe?
Will appreciate your help on this!
Hey Daniel, thanks for your message! I believe your theme is already overriding something with the same hook, however I can’t prove that unless I take a look at your theme files. If this is the case, then you’re trying to execute some code too early, and then your theme changes that around again. You will ned to search for the filter “woocommerce_ship_to_different_address_checked” through the Flatsome files to see if I’m right. Best of luck 🙂
Hi man, I would like to have the Shipping fields open be default but the checkbox uncheck.
Text above next to the checkbox should say: “Deliver to billing address?”
Then once the user checks this box (yes I would like to have it delivered to my billing address)
Then the shipping form disappears.
I have been trying to edit the form_shipping.php file but can change the text but can not get the checkbox to swop its value.
Hello Christo, thanks a million for your comment!
As all PHP customization, yes, this seems possible – unfortunately this is custom development work and I cannot provide this solution on the blog right now. I will add it to my to-write list but I cannot guarantee I will be publishing this within 2-3 months.
If you would like to get a quote for the fix, feel free to go here to get in touch.
Thanks for your understanding!
Where i to edit / add this code for our site ?
Hey Grosir, thanks for your comment! You should add this in the functions.php file of your child theme. See this tutorial if you don’t know what that means 🙂
Hi Rodolfo, thanks for your reply & response..
God bless you!
about that link, i was subscribe on your site.. but are the script just add in functions.php only ?
Yes, all these scripts (snippets) go into the functions.php only. Sometimes, some of them have CSS and that would go into style.css. Hope this helps!
Awesome tip, thanks, exactly what I was looking for. I sell a lot of gift cards so I wanted the ‘Order Notes’ text box prominently shown and this fix fit the bill perfectly.
Thanks for your feedback!