Created
January 14, 2026 12:15
-
-
Save xlplugins/6f2b4c33a8d68586057012a775fbd03d to your computer and use it in GitHub Desktop.
Trigger WooCommrce Thankyou hook for bacs on demand with shortcode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Custom Shortcode to Trigger WooCommerce 'thankyou' Hook | |
| function custom_thankyou_shortcode($atts) { | |
| // Check if WooCommerce is active | |
| if (class_exists('WooCommerce') && function_exists('WFFN_Core') && method_exists(WFFN_Core(), 'get_instance') && method_exists(WFFN_Core()->thank_you_pages, 'execute_wc_thankyou_hooks')) { | |
| // Trigger the WooCommerce 'thankyou' hook | |
| ob_start(); | |
| $order = WFFN_Core()->thank_you_pages->data->get_order(); | |
| do_action( "woocommerce_thankyou_bacs", $order->get_id() ); | |
| remove_all_actions( "woocommerce_thankyou_bacs" ); | |
| $output = ob_get_clean(); | |
| return $output; | |
| } | |
| // Return any message or content after triggering the hook | |
| return ''; | |
| } | |
| // Register the custom shortcode | |
| add_shortcode('trigger_thankyou_hook', 'custom_thankyou_shortcode'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment