skip to Main Content

Seems like it should be simple, but I can’t figure out how to change the strings "Order #" in emails or "Order Number" in Thank You page.

I want both to read "Web Order #" and "Web Order Number" respectively.

I have tried:

add_filter( 'gettext', 'translate_woocommerce_strings', 999, 3 );

function translate_woocommerce_strings( $translated, $untranslated, $domain ) {
   if ( ! is_admin() && 'woocommerce' === $domain ) {
      switch ( $translated) {
         case 'Order' :
            $translated = 'Web Order';
            break;
      }
   }     
   return $translated;
 }

2

Answers


  1. Chosen as BEST ANSWER

    Fixed email by copying email-order-details.php to child theme woocommerce/emails folder and editing line 34:

    echo wp_kses_post( $before . sprintf( __( '[Web Order #%s]', 'woocommerce' )
    

  2. For the thankyou page you can apply the same as the example above for the e-mails,
    on the following line you will find what you are looking for

    https://github.com/woocommerce/woocommerce/blob/3.8.0/templates/checkout/thankyou.php#L45

    • This template can be overridden by copying it to yourtheme/woocommerce/checkout/thankyou.php.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search