HOT
22bulbjungle
No Result
View All Result
22bulbjungle
No Result
View All Result
Home Web Development

Woocommerce Change Text on Checkout Page | Quick Tutorial

in Web Development, Woocommerce, Wordpress
Reading Time: 2 mins read
558 6
0
Woocommerce Change Text on Checkout Page | Quick Tutorial
775
SHARES
3.5k
VIEWS
Share on FacebookShare on Twitter

Woocommerce Change Text on Checkout Page tutorial will cover only how to change the texts in the woocommerce checkout page using a function. Manually changing it on the wocoommerce core files is not advisable.

Someone asked me how do they remove the words “have read and” from the Woocommerce checkout page : “I have read and accept the terms & conditions“.

RelatedPosts

How To Create a Beating Heart Shape Animation Using CSS

How To Transition a Height of Zero to a Height of Auto?

How To Apply CSS to Half of a Character

woocommerce change text on checkout page
Woocommerce Change Text on Checkout Page | Radiobox

The first step that was on my mind is using the translation function in wordpress and it should remove the 3 words by replacing the whole text statement.

I am going to change the texts using the Gettext  filter hook in WordPress. I copied the whole texts and created a function, this is the one below:

function woo_checkout_texts( $changed_text, $text, $domain ) {
if ( $changed_text == 'I have read and accept the terms & conditions' ){
$changed_text = 'I accept the terms & conditions';
}
return $changed_text;
}
add_filter( 'gettext', 'woo_checkout_texts', 20, 3 );

But the when I checked the website’s checkout page, it doesn’t change. I forgot that the link was composed of an anchor tag. Therefore when you translate something you should also add the static markup that is between the text you are translating/changing.

So how?

I looked into the woocommerce plugin folder and find the file containing the texts in it that we can copy and modify into our functions.php file. Yes, we just copy and modify it into our functions.php file.

Modifying and saving plugin’s core file is not a good practice. In a plugin update these changes will get lost.

So to make it professional as possible, I’ve search files inside the woocommerce plugin with a word “checkout”. There, I found the terms.php file. I’ve open it on my editor and found this content.

woocommerce change text on checkout page
Woocommerce Change Text on Checkout Page | Terms

Now I’ve got the idea of how to change texts on the checkout page in woocommerce.

I’ve copied the text and pasted it on functions.php with my function. I’ve copied it again as a translated text by removing the words’ “have read and”.

This is final function below:

function woo_checkout_texts( $changed_text, $text, $domain ) {
if ( $changed_text == 'I&rsquo;ve read and accept the <a href="%s" target="_blank">terms &amp; conditions</a>' ){
$changed_text = 'I accept the <a href="%s" target="_blank">terms &amp; conditions</a>';
}
return $changed_text;
}
add_filter( 'gettext', 'woo_checkout_texts', 20, 3 );

I’ve checked the checkout page, done, now it is finally translated.

This is how you customize the checkout page texts in woocommerce.

Tags: GettextWoocommerceWoocommerce checkout pageWordpress
Share310Tweet194Share78

Related Posts

How To Create a Beating Heart Shape Animation Using CSS
CSS

How To Create a Beating Heart Shape Animation Using CSS

by 22bulbjungle
December 28, 2022
0

Create the HTML structure Create the HTML structure for the heart shape. We'll use a div element with the class "heart": <div...

Read more
How to transition a height of zero to a height of Auto

How To Transition a Height of Zero to a Height of Auto?

December 23, 2022
How To Apply CSS to Half of a Character

How To Apply CSS to Half of a Character

December 23, 2022
How To Set Cellpadding and Cellspacing Using CSS

How To Set Cellpadding and Cellspacing Using CSS

December 22, 2022
Electronics, Smartphone, Computer & Tablet Repair Kit
How To Create a Beating Heart Shape Animation Using CSS

How To Create a Beating Heart Shape Animation Using CSS

December 28, 2022
How to transition a height of zero to a height of Auto

How To Transition a Height of Zero to a Height of Auto?

December 23, 2022
How To Apply CSS to Half of a Character

How To Apply CSS to Half of a Character

December 23, 2022
How To Set Cellpadding and Cellspacing Using CSS

How To Set Cellpadding and Cellspacing Using CSS

December 22, 2022
How To Prevent or Disable Copy and Paste in an Input Field

How To Prevent or Disable Copy and Paste in an Input Field

December 21, 2022
How To Turn Image Into Vintage With CSS

How To Turn Image Into Vintage With CSS

December 21, 2022

Free Do it yourself tutorials on CSS, HTML, Photoshop, Wordpress, and Woocommerce to help you learn web development and graphic design.

Follow Us

Affiliate Disclosure: 22bulbjungle is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com.

Recent Tutorials

How To Create a Beating Heart Shape Animation Using CSS

How To Create a Beating Heart Shape Animation Using CSS

December 28, 2022
How to transition a height of zero to a height of Auto

How To Transition a Height of Zero to a Height of Auto?

December 23, 2022

Categories

  • CSS
  • Duda Builder
  • Ecommerce
  • Elementor
  • Graphic Design
  • htaccess
  • Javascript
  • jQuery
  • PC Tips
  • Photoshop
  • PHP
  • Responsive design
  • Shopify
  • Video
  • Web Design
  • Web Development
  • Webdev Tips
  • Woocommerce
  • Wordpress
  • Home
  • Blog
  • Web Development
  • Graphic Design

© 2022 22BulbJungle.

No Result
View All Result
  • Home
  • Blog
  • Web Development
    • CSS
    • Javascript
    • WordPress
  • Graphic Design
    • Photoshop

© 2022 22BulbJungle.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.