Home » WooCommerce: Rename “Place Order” Based on Chosen Payment Gateway

WooCommerce: Rename “Place Order” Based on Chosen Payment Gateway

by Tutor Aspire

We’ve already seen how to rename the “Place Order” button on the WooCommerce Checkout page, but today I want to find a way to rename it dynamically and conditionally i.e. based on the payment gateway that is selected while checking out.

The snippet requires the payment gateway “ID” – here’s a quick tut in case you don’t know how to retrieve that: How to Find WooCommerce Payment Gateway ID

Other than that, it’s pretty simple logic. Enjoy!

With the snippet below, once “Bank Transfer” (bacs) is selected, the “Place Order” button becomes “View Bank Details”. If I had a second payment gateway, such as COD, I could have also modified the label, and this would have changed instantly upon COD select.

PHP Snippet: Rename “Place Order” Button Dynamically Based on Selected Payment Gateway @ WooCommerce Checkout

 * @snippet       Rename "Place Order" By Gateway @ WooCommerce Checkout
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 6
 * @donate $9     https://tutoraspire.com

add_filter( 'woocommerce_available_payment_gateways', 'tutoraspire_rename_place_order_button' );

function tutoraspire_rename_place_order_button( $gateways ) {
    if ( $gateways['bacs'] ) {
        $gateways['bacs']->order_button_text = 'View Bank Details';
    } elseif ( $gateways['cod'] ) {
        $gateways['cod']->order_button_text = 'Confirm Cash on Delivery';
    return $gateways;

You may also like