WordPress filter hook

woocommerce_thankyou_order_key

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

“Filters the order key used to validate the order shown on the thanks page.”

How to use woocommerce_thankyou_order_key

It's a filter: your callback receives the value, 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_key', function( $order_key ) {
	// Change $order_key here.
	return $order_key;
}, 10, 1 );

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

40 plugins that fire woocommerce_thankyou_order_key

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_key', ( empty( $_GET['key'] ) || ! is_string( $_GET['key'] ) ) ? '' : sanitize_text_field( wp_unslash( $_GET['key'] ) ) ) includes/shortcodes/class-wc-shortcode-checkout.php:324
  2. Essential Addons for Elementor icon Essential Addons for Elementor1+ million installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( wp_unslash( $_GET['key'] ) ) ) includes/Template/Woocommerce/Checkout/Woo_Checkout_Helper.php:77
  3. WooPayments: Integrated WooCommerce Payments icon WooPayments: Integrated WooCommerce Payments800,000+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( wp_unslash( $_GET['key'] ) ) ) includes/class-wc-payments-order-success-page.php:422
  4. GTM4WP icon GTM4WP700,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) src/Modules/WooCommerce/PageDataLayer.php:683
  5. CartFlows icon CartFlows200,000+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET[ $key_param ] ) ? '' : wc_clean( wp_unslash( $_GET[ $key_param ] ) ) ) modules/thankyou/classes/class-cartflows-thankyou-markup.php:287
  6. Mollie Payments for WooCommerce icon Mollie Payments for WooCommerce100,000+ installs apply_filters( 'woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean(filter_input(\INPUT_GET, 'key', \FILTER_SANITIZE_SPECIAL_CHARS)) ) src/Gateway/MolliePaymentGatewayHandler.php:332
  7. Snapchat for WooCommerce icon Snapchat for WooCommerce90,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) includes/Utils/Helper.php:109
  8. AI Powered Marketing icon AI Powered Marketing40,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) classes/class-helper.php:151
  9. Kliken: Ads + Pixel for Meta icon Kliken: Ads + Pixel for Meta30,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) classes/class-tracker.php:964
  10. GTM Kit icon GTM Kit30,000+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( wp_unslash( $_GET['key'] ) ) ) src/Integration/WooCommerce.php:525
  11. UiChemy icon UiChemy8,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $key ) uichemy-composer/includes/admin/widgets/class-uichemy-woo-tags.php:443
  12. LocalWeb All In One icon LocalWeb All In One5,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) public/partials/lw-all-in-one-public-woocommerce-gtm.php:380
  13. Tabby Checkout icon Tabby Checkout4,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $key ) includes/functions.php:52
  14. WowStore icon WowStore4,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) classes/Functions.php:237
  15. Ultimate Store Kit icon Ultimate Store Kit3,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) includes/helper.php:1551
  16. Responsive Addons for Elementor icon Responsive Addons for Elementor3,000+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( wp_unslash( $_GET['key'] ) ) ) traits/responsive-addons-for-elementor-woo-checkout-helper.php:103
  17. Custom Thank You Page for WooCommerce icon Custom Thank You Page for WooCommerce2,000+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) includes/class-wccty-order-resolver.php:59
  18. 워드프레스 결제 심플페이 icon 워드프레스 결제 심플페이900+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET[ 'key' ] ) ? '' : pafw_get_unslash( $_GET, 'key' ) ) pgall-for-woocommerce.php:335
  19. PlatiOnline Payments icon PlatiOnline Payments700+ installs apply_filters( 'woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean($_GET['key']) ) inc/core/class-wc-plationline-process.php:152
  20. Tealium icon Tealium600+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ) tealium.php:241
  21. NewsmanApp icon NewsmanApp500+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) includes/remarketing/action/class-purchase.php:179
  22. Rapyd Payment Extension for WooCommerce icon Rapyd Payment Extension for WooCommerce500+ installs apply_filters( 'woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean($_GET['key']) ) includes/abstracts/abstract-wc-rapyd-payment-gateway.php:85
  23. Fathom Analytics Conversions icon Fathom Analytics Conversions400+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ) admin/class-fathom-analytics-conversions-woocommerce.php:83
  24. Noah Shop Builder for WooCommerce icon Noah Shop Builder for WooCommerce400+ installs apply_filters( 'woocommerce_thankyou_order_key', $key ) includes/Templates/Types/OrderReceived.php:193
  25. Custom Thank You for WooCommerce icon Custom Thank You for WooCommerce300+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ) includes/class-ctyw-settings.php:170
  26. Tapfiliate icon Tapfiliate300+ installs apply_filters( 'woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean($_GET['key']) ) woocommerce/tracking-code.php:27
  27. LSX Customizer icon LSX Customizer100+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ) classes/class-lsx-customizer-woocommerce.php:343
  28. Custom Thank You Pages PRO for WooCommerce icon Custom Thank You Pages PRO for WooCommerce90+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ) wc-custom-thank-you-pages.php:117
  29. Paiement par Carte DAHABIA et Carte CIB for WooCommerce icon Paiement par Carte DAHABIA et Carte CIB for WooCommerce70+ installs apply_filters( 'woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wp_unslash($_GET['key']) ) paiement-par-carte-dahabia-et-cib-for-woocommerce.php:113
  30. Beslist Tracking icon Beslist Tracking60+ installs apply_filters( 'woocommerce_thankyou_order_key', $orderKey ) src/WooCommerceWebhookHandler.php:432
  31. 2Checkout Dynamic Payment Gateway for WooCommerce icon 2Checkout Dynamic Payment Gateway for WooCommerce40+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : woocommerce_clean( $_GET['key'] ) ) gateway-2Checkout.php:103
  32. Datalayer Tracking via DATA Reshape for WooCommerce icon Datalayer Tracking via DATA Reshape for WooCommerce20+ installs apply_filters( 'woocommerce_thankyou_order_key', $this->get_query_arg_text( 'key' ) ) includes/trait-frontend.php:231
  33. Custom Thank you for Woo icon Custom Thank you for Woo10+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) ) index.php:115
  34. Max Elements for Elementor icon Max Elements for Elementor10+ installs apply_filters( 'woocommerce_thankyou_order_key', empty($_GET['key']) ? '' : wc_clean(sanitize_text_field(wp_unslash($_GET['key']))) ) elementor/helpers/woo_checkout.php:76
  35. PayM8 Gateway icon PayM8 Gateway10+ installs apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( wp_unslash( $_GET['key'] ) ) ) includes/class-wc-gateway-paym8.php:276
  36. PAAY for WooCommerce icon PAAY for WooCommerce10+ installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) lib/Paay/Gateway.php:102
  37. Storzen icon StorzenFewer than 10 installs apply_filters( 'woocommerce_thankyou_order_key', $key_raw ) elementor/widgets/class-storzen-style-thankyou-widgets.php:65
  38. eCheckpoint icon eCheckpointFewer than 10 installs apply_filters( 'woocommerce_thankyou_order_key', $key ) echeckpoint_verification-prompt.php:354
  39. Custom Thank You Woo icon Custom Thank You WooFewer than 10 installs apply_filters( 'woocommerce_thankyou_order_key', $order_key ) custom-thank-you-woo.php:169
  40. Platecraft Addons for Elementor icon Platecraft Addons for ElementorFewer than 10 installs apply_filters( 'woocommerce_thankyou_order_key', is_string( $key ) ? sanitize_text_field( wp_unslash( $key ) ) : '' ) includes/widgets/class-thank-you.php:309

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.