• Resolved yoonlaserwp23

    (@yoonlaserwp23)


    I would like to add one more sentence to the ‘Create an account?’ text next to the checkbox on my checkout page.
    I tried adding a text on the child-theme/woocommerce/checkout/form-billing.php because I thought the file is the template file that I need to copy and edit to change the sentence, but it didn’t work.
    So I directly edit the file under woocommerce/templates/checkout/form-billing.php, but it didn’t show the new sentence either.
    What do I need to do to change the sentence?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @yoonlaserwp23

    I would like to add one more sentence to the ‘Create an account?’ text next to the checkbox on my checkout page.

    I tried adding a text on the child-theme/woocommerce/checkout/form-billing.php because I thought the file is the template file that I need to copy and edit to change the sentence, but it didn’t work. So I directly edit the file under woocommerce/templates/checkout/form-billing.php, but it didn’t show the new sentence either. What do I need to do to change the sentence?

    From what I understand, you’re trying to add an extra sentence to the ‘Create an account?’ text on your checkout page, but you’re having trouble making it visible after editing the form-billing.php file.

    No worries, I’ve got a solution for you! You can achieve this by using a handy plugin called ?? Loco Translate. This translation plugin lets you modify or add any text on your WooCommerce site, without the need to directly edit the template files.

    Here’s a step-by-step guide to help you:

    1. First, install and activate the Loco Translate plugin on your WordPress site.
    2. From your WordPress dashboard, go to Loco Translate > Plugins.
    3. Pick WooCommerce from the list of plugins.
    4. Click on the New Language link and select your language if it’s not already listed. If it is, just click on it.
    5. You’ll be directed to a screen with a list of all the strings available for translation in WooCommerce. Use the search box to locate the ‘Create an account?‘ string.
    6. Once you’ve found it, click on it and you’ll find a box where you can type in your extra sentence.
    7. After inputting your sentence, click on the Save button.

    Here’s a snapshot to guide you: 

    Image Link: https://snipboard.io/5iEohz.jpg

    You should now see your new sentence next to the ‘Create an account?’ checkbox on your checkout page. Check out this image for reference:

    Image Link: https://snipboard.io/8ACSz5.jpg

    I hope this helps! If you have any other questions or need further assistance, feel free to ask.

    Thread Starter yoonlaserwp23

    (@yoonlaserwp23)

    Is there any way that I can add the text without an additional plugin? My site already has too many plugins installed. That’s why.
    Also, I would like to know why editing the form-billing.php file doesn’t work.

    Hi @yoonlaserwp23

    Is there any way that I can add the text without an additional plugin? My site already has too many plugins installed. That’s why. Also, I would like to know why editing the form-billing.php file doesn’t work.

    Thank you for your reply and for providing more details about your situation. I completely understand your concern about adding more plugins to your site.

    You’re absolutely right, you can add the text without needing another plugin. To do this, it’s best to utilize filters in your theme’s functions.php file.

    The reason your edits to the form-billing.php file didn’t take effect is that WooCommerce, by default, loads templates from the plugin’s templates folder. Any changes you make to these files will be overwritten when the plugin updates. So, it’s better to override WooCommerce templates by copying them to your theme or child theme.

    Let’s get to the solution now. You can change the ‘Create an account?’ text using the ‘gettext’ filter. Here’s a sample code for your theme’s functions.php file:

    add_filter( 'gettext', 'change_create_account_text', 20, 3 );
    
    function change_create_account_text( $translated_text, $text, $domain ) {
    if ( 'woocommerce' === $domain && 'Create an account?' === $text ) {
    $translated_text = 'Create an account? Your new text here.';
    }
    return $translated_text;
    }

    Just remember to replace ‘Your new text here.‘ with the sentence you want to add. It’s always a good idea to use a child theme when making these changes to avoid losing them when your theme updates.

    You should add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, like the Code Snippets plugin. Please note that it’s not advisable to add custom code directly to your parent theme’s functions.php file. Doing so could lead to the code being erased when the theme is updated.

    ?? Just a quick reminder: Before you make any changes, we strongly recommend that you create a backup of your full site and database. This is a crucial step to ensure that in case anything goes wrong, you can easily restore your site to its previous, functioning state.

    I hope this helps! If you have any more questions, feel free to ask.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add more text on the ‘create an account’ at checkout page’ is closed to new replies.