PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, August 26, 2022

[FIXED] How to Change WooCommerce "Create an account" Text?

 August 26, 2022     woocommerce, wordpress     No comments   

Issue

I'm facing a problem to change the "Create an account" text on the checkout page of woocommerce. I searched on Google but didn't find any result. How to modify the text?

create an account woocommerce


Solution

There's no need to modify the template you can use a filter to change the text. Copy and paste into your theme's functions.php file. It's a much cleaner solution as template files may need updating in the future.

function my_text_strings( $translated_text, $text, $domain ) {
    if ( 'woocommerce' !== $domain ) {
        return $translated_text;
    }
    
    switch ( $translated_text ) {
        case 'Create an account?' :
            $translated_text = __( 'This is the new text that will be displayed!', 'woocommerce' );
            break;
    }
    return $translated_text;
}

add_filter( 'gettext', 'my_text_strings', 20, 3 );


Answered By - Andrew Schultz
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing