Quantcast
Channel: mgason – gasolicious.com
Viewing all articles
Browse latest Browse all 11

Uncheck default “Ship to different address” on woocommerce checkout using functions.php

$
0
0

“Ship to different address” is the default setting on woocommerce checkout.

There has been much discussion about why this is or is not a good idea. See this thread https://github.com/woocommerce/woocommerce/issues/2571
As we all know, in the end though the client rules, and this is what my client had to say.

The “ship to a different address” box was checked by default. which is a bit annoying because if you don’t notice it (like I did) and you enter your credit card info, then there’s a message telling you need to fill up the missing info for your shipping address. Then you uncheck the box and your credit card info disappear, giving you no choice but to enter everything again (annoying!)

Now that credit card data re-entry issue is annoying, why it happens is another matter. I am not sure if it is just with inline Stripe or other methods such as PayPal too. But for me, unchecked box equals happy client. This simple line of code in your functions.php file will take care of it. Use a child theme, do not edit your themes functions.php, see the info box below if you don’t know about that.

add_filter( 'woocommerce_ship_to_different_address_checked', '__return_false' );

 
Obviously to make it checked, which it should be by default anyway, you would set it to true.
 

Tools:

You may edit your PHP outside WordPress and upload it to your server. You must use an appropriate code editor NOT microsoft word or anything like that which adds a lot of invisible formatting and will be a disaster.
If you do not have one, 2 excellent free ones are…
TextWrangler for Mac, http://www.barebones.com/products/textwrangler/
Notepad++ for the PC http://notepad-plus-plus.org/

Child Themes

You want to change code in a way that will not be over-written when you update your theme. So if you do not already have one you should setup a child theme. I always do this if I am making any changes to the main theme, even if it is only CSS. That is not the topic of this post so here is a link to a tutorial on creating a child theme, you will find the WordPress codex article here.


Viewing all articles
Browse latest Browse all 11

Latest Images

Trending Articles





Latest Images