Below is a list of action hooks that are available in the WP Express Checkout plugin.
Table of Contents
Payment Processing Related
wpec_payment_completed
This action hook executes after a transaction is completed. This can be used to do some additional tasks after a transaction takes place.
Below is an example of how to use this hook
add_action('wpec_payment_completed', 'wpec_after_txn_callback', 10 ,3); function wpec_after_txn_callback ($payment, $order_id, $item_id) { //Do stuff //$payment is the payment data array. //print_r($payment);//Lets see what info is in this array. }
Thank You Page Related
before_wpec_thank_you_page_shortcode_execution
This action hook is triggered before processing the shortcode for the thank you page. The example code provided below aims to redirect visitors who navigate to this page without an order ID.
add_action('before_wpec_thank_you_page_shortcode_execution', 'my_custom_ty_page_redirect'); function my_custom_ty_page_redirect() { if (!isset($_GET['order_id']) && !isset($_GET['_wpnonce'])) { //Do the redirection to your desired URL $redirect_url = 'https://example.com/no-direct-access'; Utils::redirect_to_url($redirect_url); } }