Replace heading texts on admin single Order pages only in WooCommerce Replace heading texts on admin single Order pages only in WooCommerce wordpress wordpress

Replace heading texts on admin single Order pages only in WooCommerce


The following will only target Admin single "edit" (and "new") order pages:

add_filter(  'gettext',  'change_admin_single_order_heading3', 10, 3 );add_filter(  'ngettext',  'change_admin_single_order_heading3', 10, 3 );function change_admin_single_order_heading3( $translated, $text, $domain  ) {    global $pagenow;    if ( is_admin() && ( ( $pagenow === 'post.php' && isset($_GET['post']) && get_post_type($_GET['post']) === 'shop_order' )    || ( $pagenow === 'post-new.php' && isset($_GET['post-type']) && $_GET['post-type'] === 'shop_order' ) ) ) {        if( $text === 'Billing' && $domain === 'woocommerce' ){            $translated = esc_html__( 'Sender Information', $domain );        }        if( $text === 'Shipping' && $domain === 'woocommerce' ){            $translated = esc_html__( 'Recipient Information', $domain );        }        // Addition asked in your comment        if( $text === 'Shipping:' && $domain === 'woocommerce' ){            $translated = esc_html__( 'Some text', $domain );        }    }    return $translated;}

Code goes in function.php file of your active child theme (or active theme). Tested and works.