Blog Categories Tips & Tricks Contact
HOME
WOOCOMMERCE HOW TO CHANGE PLACE ORDER BUTTON TEXT IN WOOCOMMERCE?
FOLLOW US
Stay updated via social channels
How to Change Place Order Button Text in
WooCommerce?
HOW TO
WOOCOMMERCE
AMAN MEHRA
JUNE 28, 2021
LEAVE A COMMENT
Get New Post By Email
Tweet on Twitter
Share on Facebook
Name
Your email address
SUBSCRIBE
RECENT POSTS
Twitter Search API Example Using
PHP
Export HTML Table to CSV Using
JavaScript
What is the Difference Between Git
In this article, we will learn how to change the place order button text on fetch and Git pull?
woocommerce checkout page?
How to Change Proceed to
Checkout Button Text in
This button text changes dynamically according to the selected payment WooCommerce?
method. If you have more than one payment method then it will change
How to Add Watermark to Image
accordingly like for the PayPal button text is “Proceed to Paypal” and for the Using PHP?
COD button text is “Place Order“.
So, in this article, we will learn to change the place order button text with our
CATEGORIES
own custom text.
Git
Let’s get started. How To
JavaScript
Table of Contents Laravel
1
Change the Place Order Button Text in WooCommerce
PHP
1.1
Method 1: Change Place Order Button Text with
Python
woocommerce_order_button_text
1.2
Method 2: Change Place Order Button Text with ReactJS
woocommerce_order_button_html
WooCommerce
1.3
Method 3: Change Place Order Button Text with Template file
(payment.php) WordPress
2
Change the Place Order Button Text on WooCommerce Checkout Based
on Specific Product in Cart
3
Change the Button Text For Other Payment Gateways MOST VIEWED POSTS
WooCommerce Remove Update
Cart Button and Make it
Change the Place Order Button Text in Automatically Update.
WooCommerce How to Redirect to Checkout After
Add to Cart?
You can change the place order button text in 3 ways.
How to Change Price of Specific
Product and Quantity in Cart?
For the first two methods, you need to hook a function in the functions.php file
to change the text, which we will see below with examples. Upload Multiple Featured Images
in a Post OR Page
Hooks are: How can I Prevent SQL Injection in
woocommerce_order_button_text
PHP?
woocommerce_order_button_html
And in the third method, you can change the woocommerce template file, if you TIPS & TRICKS
know about how to override the woocommerce template file.
Disable right-click with jQuery
File-path is: Undo a last git commit and redo
plugins > woocommerce > templates > checkout > Get Query String Parameters From
payment.php URL in JavaScript
BuddyPress Members Not
Let’s start with hook’s methods. Showing Until Login
Check the Memory Consumed By
Method 1: Change Place Order Button Text with Variables in Python
woocommerce_order_button_text
This is a very simple method to change the button text. You just have to hit the
function with this hook filter and return the custom own text.
Copy the below code in your active theme’s functions.php file (I would
recommend child theme to use any customization).
1 add_filter( 'woocommerce_order_button_text', 'ybc_custom
2
3 function ybc_custom_place_order_button_text( $button_tex
4 // your custom text here
5 return 'Make Order';
6 }
After inserting this code in your functions.php file save it and check the result on
woocommerce checkout page. You will see the difference, like the below
images.
Before hook function
After hook function
Method 2: Change Place Order Button Text with
woocommerce_order_button_html
With this filter hook method, we can also change the place order button text with
our own custom text. It is also a simple method.
This filter hook woocommerce_order_button_html returns the button
HTML and we will use str_replace() , substr_replace() or
preg_replace() PHP function to replace the “Place Order” text in the
HTML.
You can also create the button HTML from scratch and make it as per your
requirements.
Let’s see the code.
1 add_filter( 'woocommerce_order_button_html', 'ybc_custom
2
3 function ybc_custom_place_order_button_html( $button_htm
4 $button_html = str_replace( 'Place order', 'Make Ord
5 return $button_html;
6 }
Place this above code in your theme’s functions.php file and save it. And you
will see the result same as the first method.
Method 3: Change Place Order Button Text with Template
file (payment.php)
In this method, we will override the woocommerce template file to change the
place order button text.
Note: Use the child theme to override the woocommerce template files OR any
changes you want to make. Check this step-by-step guide, If you don’t know how
to create a child theme in WordPress.
Let’s see how to do that.
Firstly, you need to find this file (payment.php) in woocommerce’s templates
folder and then copy this file in your theme folder.
1. Go to this path plugins > woocommerce > templates > checkout
2. Find the payment.php file and copy it
3. Create a new folder “woocommerce” in your active theme and create a new
folder “checkout” inside woocommerce folder
4. And place that copy file in the checkout folder
5. Now, you can make changes in this file. You will see the button in this file file
like below image
Place Order Button in Template File (payment.php)
In this code, you can change the button text.
Note: I will recommend using the above two filter hooks methods that are very
simple and easy.
Change the Place Order Button Text on
WooCommerce Checkout Based on Specific
Product in Cart
Yes! you can change the place order button text based on the specific product
or category in the cart OR you can make any condition.
We just have to make a condition in the above methods to check is it true or
not? If it will true then the button text will change otherwise not.
Let’s see with example code.
1 add_filter( 'woocommerce_order_button_text', 'ybc_custom
2
3 function ybc_custom_place_order_button_text( $button_tex
4
5 $cat_check = false;
6
7 foreach ( WC()->cart->get_cart() as $cart_item_key =
8
9 $product = $cart_item['data'];
10 // check if shoes category product in cart
11 if ( has_term( 'shoes', 'product_cat', $product
12 $cat_check = true;
13 break;
14 }
15 }
16
17 if ( $cat_check ) {
18 return 'Make Order';
19 }
20
21 }
In the above example, we check that the “shoes” category product exists in the
cart or not. If it will exist then the place order button text will be changed else
not.
You can also check the specific product with the ID. e.g:
1 $product_id = 22;
2
3 if( WC()->cart->find_product_in_cart( WC()->cart->genera
4 return 'Make Order';
5 }
This code will change the place order button text only for product ID 22 if it is in
the cart.
Change the Button Text For Other Payment
Gateways
You can also change the button text for other payment gateways.
Suppose, if other payment gateways OR your custom payment gateway don’t
have a hook to change the button text then what you will do? Because you
cannot make plugin file changes directly.
So, in this case, you will use gettext filter hook to achieve this. It will work
for mostly all payment gateways and you can also use this to change any text
in woocommerce files.
Let’s see the code.
1 add_filter( 'gettext', 'ybc_change_paypal_button_text',
2
3 function ybc_change_paypal_button_text( $translated_text
4
5 if( $translated_text == 'Proceed to PayPal' ) {
6 $translated_text = 'Continue to PayPal';
7 }
8
9 return $translated_text;
10 }
Place this code in your active theme’s functions.php file and save it. And then
you will see the button text has been changed for the PayPal payment gateway.
See the following images before and after the gettext filter hooks.
PayPal Button Before gettext hook
PayPal Button After gettext hook
You can also change the translatable text with the plugin Say What.
Installed and Activate the SayWhat plugin. Follow this step-by-step guide on
how to install the WordPress plugin?
After installation, you will find the option under Tools >Text Changes. And add a
new Text Changes to change any specific text in woocommerce.
That’s it.
Hope! you understand the above methods about how to change woocommerce
place order button text and also change for if a specific product in cart and
change the button text for other payment gateways.
If you have any query ask me in the comment section, I’ll respond to you asap.
CHANGE PLACE ORDER BUTTON TEXT WOOCOMMERCE CHECKOUT GETTEXT
PLACE ORDER BUTTON SAYWHAT PLUGIN WOOCOMMERCE WOOCOMMERCE ACTION
WOOCOMMERCE CHECKOUT WOOCOMMERCE ORDER BUTTON TEXT
WOOCOMMERCE PLACE ORDER BUTTON HOOK WOOCOMMERCE_ORDER_BUTTON_HTML
WOOCOMMERCE_ORDER_BUTTON_TEXT
Tweet on Twitter
Share on Facebook
YOU MAY ALSO LIKE
How to Change Proceed to Checkout How to Add Watermark to Image
Button Text in WooCommerce? Using PHP?
How to Create Nested Functions in How to Implement Multiple
Python? Constructors For Class in Python?
Custom Validation in WooCommerce How to Re-Order WordPress Posts By
Checkout Form Custom Field?
ABOUT THE AUTHOR: AMAN MEHRA
Hey! I'm Aman Mehra and I'm a full-stack developer and have 5+
years of experience. I love coding and help to people with this blog.
LEAVE A REPLY
Your email address will not be published. Required fields are marked *
Comment
Name * Email * Website
Save my name, email, and website in this browser for the next time I comment.
POST COMMENT
ABOUT QUICK LINKS RECENT POSTS GET IN TOUCH
Your Blog Coach is the best site Blog Twitter Search API Example Using
Name
for finding the solution to any PHP
Categories
issue related to coding and learn
Export HTML Table to CSV Using Your email address
more cool stuff and tricks. Contact
JavaScript
About
What is the Difference Between SUBSCRIBE
Git fetch and Git pull?
© 2020 Your Blog Coach Privacy Policy
Terms and Conditions
Sitemap