By default WooCommerce pre-populate checkout fields when a previous order was made. That is so useful because you don’t need to re-enter your personal details: first name, last name, address etc…
But today i’ve been contacted by someone that wanted to NOT pre-populate shippings fields. Here is why:
Each time one of our retailers makes a purchase from our site, they are entering a different ship-to address for us to ship the order directly to their customer.
That’s interesting! And i guess some of you use WooCommerce in the same way, and might be interested to know how to not pre-populate checkout fields. The Solution is pretty simple.
The best way to do so is to work with WooCommerce custom templates. Basically a custom template allows you to override WooCommerce default files and use your own custom files instead. Here is a quick tutorial that will explain you how to create your custom templates.
Open the following file checkout/form-shipping.php and replace line 39 :
<?php woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); ?>
<?php woocommerce_form_field( $key, $field, ” ); ?>
That’s to say you remove $checkout->get_value( $key ) and you replace it by ”. You can also do the same at line 61, it’s up to you.