Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #833456

    tafrancis
    Participant

    In the woocommerce checkout page I would like to change the title of the check box ‘ship to a different address?’
    I am using a custom font which doesn’t have a question mark so it’s displaying a square instead, so I would like to be able to remove the question mark from the title.

    I have tried adding the following to my child theme functions.php:

    // WooCommerce Checkout Fields Hook
    add_filter( ‘woocommerce_checkout_fields’ , ‘custom_wc_checkout_fields’ );

    // Change order comments placeholder and label
    function custom_wc_checkout_fields( $fields ) {
    $fields[‘order’][‘order_comments’][‘placeholder’] = ‘new placeholder text’;
    $fields[‘order’][‘order_comments’][‘label’] = ‘new label’;
    $fields[‘shipping’][‘ship-to-different-address-checkbox’][‘label’] = ‘Ship to a different address’;
    return $fields;
    }

    This has changed the order comments label and placeholder text but has not changed the ship to a different address.

    website is: http://development.horseboxcoffeeco.com/checkout/

    Any help on how to achieve this appreciated.

    #833527

    Zeshan
    Member

    Hi there,

    Thanks for writing in!

    To change that, try adding following code in your child theme‘s functions.php file:

    // =============================================================================
    // Translate strings using 'gettext' filter hook.
    // =============================================================================
    
    add_filter('gettext', 'custom_strings_translation', 20, 3);
    
    function custom_strings_translation( $translated_text, $text, $domain ) {
    
      switch ( $translated_text ) {
        case 'Ship to a different address?' : 
          $translated_text =  __( 'Ship to a different address', '__x__' ); 
          break;
      }
    
      return $translated_text;
    }
    

    Thank you!

    #834654

    tafrancis
    Participant

    Worked perfectly. Many thanks

    #834658

    Christopher
    Moderator

    You’re welcome.