skip to Main Content

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


  1. There’s a filter for this.

    add_filter( 'woocommerce_ship_to_different_address_checked', '__return_false' );

    _return_true makes it checked by default.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search