Woo Commerce Place Order Button Text

Hello,

I am trying to change the text of the “place order” button in WooCommerce. I am using the following in my functions.php file…

add_filter( ‘woocommerce_order_button_text’,
‘woo_custom_order_button_text’);

function woo_custom_order_button_text() {
return __( ‘Donate Now’, ‘woocommerce’ );
}

I can see the button change for a split second on page load then it returns to the original text. Is there something in xtheme that is overriding my changes?

I have found this topic to be helpful in the past but can’t get it to work in this situation.

Any help would be appreciated!
Thanks!

Hi @JasonM,

Thanks for reaching out.
To change the Place Order text in Checkout page, you need to add the followinf code in your child theme’s functions.php file.

function change_place_order_text( $translated, $text, $domain ) 
{
    if( is_checkout() && $translated == 'Place order' )
    {
        $translated = 'Your Text';
    }
    return $translated;
}
add_filter( 'gettext', 'change_place_order_text', 20, 3 );

Please remember that the above code will work if copied as it is and don’t conflict with any existing style.
Please note that the code provided serves only as a guide to help you get started custom coding on your own if there’s no option offered in our theme or the products we bundle.
We really do not provide support for custom codes that means we can’t fix it in case it conflicts with something in your site nor will we enhance it.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.