WordPress filter hook

woocommerce_thankyou_order_failed_text

Defined by WooCommerce and fired by 5 plugins in total, running on 7M+ sites between them.

“Filters the message shown when an order has failed.”

How to use woocommerce_thankyou_order_failed_text

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_thankyou_order_failed_text', function( $default, $order ) {
	// Change $default here.
	return $default;
}, 10, 2 );

Argument names come from Noah Shop Builder for WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

5 plugins that fire woocommerce_thankyou_order_failed_text

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_thankyou_order_failed_text', $order_failed_text, $order ) src/Blocks/BlockTypes/OrderConfirmation/Status.php:161
  2. CheckoutWC Lite icon CheckoutWC Lite2,000+ installs apply_filters( 'woocommerce_thankyou_order_failed_text', __( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'woocommerce' ), $order ) functions/template-functions.php:1705
  3. Noah Shop Builder for WooCommerce icon Noah Shop Builder for WooCommerce400+ installs apply_filters( 'woocommerce_thankyou_order_failed_text', $default, $order ) includes/Blocks/OrderBlocks.php:280
  4. Cresta Checkout for WooCommerce icon Cresta Checkout for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_thankyou_order_failed_text', $default, $order ) inc/blocks/blocks-thankyou.php:219
  5. Aiolos Checkout for WooCommerce icon Aiolos Checkout for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_thankyou_order_failed_text', esc_html__( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'aiolos-checkout-for-woocommerce' ), $order ) templates/checkout/thankyou.php:24

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.