WooCommerce Text String Changer
Change any WooCommerce wording, in the classic checkout and the block-based Cart and Checkout, without a translation plugin.
Your details
Your snippet
<?php
/**
* Change WooCommerce wording on the classic (shortcode) checkout and the block-based Cart/Checkout.
*/
add_filter( 'gettext_woocommerce', 'ea_change_checkout_text', 20, 3 );
function ea_change_checkout_text( $translated, $text, $domain ) {
$strings = array(
'Place order' => 'Confirm & pay',
'Proceed to Checkout' => 'Continue to checkout',
);
return isset( $strings[ $text ] ) ? $strings[ $text ] : $translated;
}
add_action( 'wp_enqueue_scripts', 'ea_change_checkout_text_blocks' );
function ea_change_checkout_text_blocks() {
if ( ! is_checkout() && ! is_cart() ) {
return;
}
wp_enqueue_script( 'wp-hooks' );
$strings = array(
'Place order' => 'Confirm & pay',
'Proceed to Checkout' => 'Continue to checkout',
);
$js = 'wp.hooks.addFilter("i18n.gettext_woocommerce","ea/change-text",function(t,text){var s=' . wp_json_encode( $strings ) . ';return (s[text]!==undefined)?s[text]:t;});';
wp_add_inline_script( 'wp-hooks', $js, 'after' );
}The PHP filter (gettext_woocommerce) covers classic checkout pages, emails and admin text. The JS filter (i18n.gettext_woocommerce) covers the block-based Cart and Checkout, which render in the browser, not PHP.
As JSON for reference, the word list is: {"Place order":"Confirm & pay","Proceed to Checkout":"Continue to checkout"}
This matches whole strings exactly. If a string uses a placeholder (like a product name built with sprintf()), it usually can't be matched this way.
Two systems, one snippet
Every translatable WooCommerce string is wrapped in __( 'text', 'woocommerce' ). On classic (shortcode) pages, that call passes through the gettext_woocommerce filter before it's printed, so a PHP function can swap the exact text for something else.
The block-based Cart and Checkout are a React app, and their text goes through @wordpress/i18n in the browser instead of PHP. That package applies its own filter, i18n.gettext_woocommerce, registered with wp.hooks.addFilter(). The generated snippet enqueues a small inline script that adds this filter, so the same word list changes both.
| Where | What runs the filter | Filter name |
|---|---|---|
| Classic cart/checkout shortcodes, emails, admin | PHP | gettext_woocommerce |
| Block Cart and Checkout | JavaScript (@wordpress/i18n) | i18n.gettext_woocommerce |
Using the snippet
- 01
Copy the exact original text
Match capitalization and punctuation exactly, including trailing colons or ellipses; the filter does an exact string match.
- 02
Paste the snippet
Add it to a site-specific plugin or your child theme's functions.php.
- 03
Check both checkouts
If your theme still uses the
[woocommerce_checkout]shortcode, test that page; if it uses the block-based Checkout page, test that one too. Many stores only need one.
For a fully translated multilingual store, use a translation plugin (Loco Translate, WPML, Polylang) instead: this snippet changes English wording, it doesn't create a second language, and it won't survive if a real translation .mo file already defines that string differently for a visitor's locale.
Questions people ask
Why didn't my text change on the checkout page?
Either the original text doesn't match exactly (check for a trailing space or different capitalization), or you're editing the wrong checkout: classic pages need the PHP filter, the block-based Checkout page needs the JS filter. This tool generates both, so add the whole snippet.
Can I change text that includes a placeholder, like a price or a product name?
This tool matches whole strings, so it works for static text like button labels and headings. Text built with sprintf() and a variable (like an error message that includes a product name) usually can't be matched as one fixed string; those need a more specific filter for that message.
Does this affect WooCommerce's own emails?
The PHP half does, since emails render through the same __( 'text', 'woocommerce' ) calls. The JS half only runs on pages that load the block Cart/Checkout scripts.
Will a WooCommerce update undo my changes?
No. The filter changes what's displayed at runtime; it doesn't touch WooCommerce's files, so it survives updates. If WooCommerce changes the original wording in a future version, your match will stop firing and you'll need to update the original text in the snippet.
Related tools
Last reviewed 30 September 2026.
Sources: WordPress Developer Reference: __() · WordPress Gutenberg source: @wordpress/i18n · WooCommerce source: Blocks/BlockTypes/Checkout.php
