• Hello Team,

    kindly advise why below code is not changing ‘View cart’ to ‘View Orders’?

    https://snipboard.io/3xjZ10.jpg

    function change_cart_totals_string2( string $translation2, string $text2, string $domain2 ): string {
    	if ( 'View cart' === $text2 ) {
    		return 'View Orders';
    	}
    	return $translation2;
    }
    add_filter( 'gettext_woocommerce', 'change_cart_totals_string2', 10, 3 ); 

    Thanks,

    Roshan

    • This topic was modified 2 years, 8 months ago by Jan Dembowski.
Viewing 1 replies (of 1 total)
  • @roshanbi

    You are using wrong function argument and filter to replace text. use below code.

    function change_cart_totals_string2( $translation2)
    {
            $translation2 = str_ireplace( 'View cart',  'View Orders', $translation2 );
    	return $translation2;
    }
    add_filter( 'gettext', 'change_cart_totals_string2', 10, 3 );

    I hope this will help you!

Viewing 1 replies (of 1 total)
  • The topic ‘change wordings’ is closed to new replies.