Recently I used the following to change the text of “Ship to different address” on Woocommerce checkout page
function shipchange( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Ship to different address?' :
$translated_text = __( 'Other', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter('gettext', 'shipchange', 20, 3);
but I noticed that the checkbox is checked from the start. How can I have the checkbox unchecked by default?
2
Answers
There’s a filter for this.
add_filter( 'woocommerce_ship_to_different_address_checked', '__return_false' );
_return_true
makes it checked by default.You can just change this in the WooCommerce shipping options.
WooCommerce–> Shipping Options–> Shipping Destination –> (select) Default to customer billing address.
"Ship to a different address" will not checked by default.