Home / Admin / Template: After Order Actions
Duplicate Snippet

Embed Snippet on Your Site

Template: After Order Actions

This is a template that can be used to hook into the `edd_after_order_actions` hook, allowing developers to run non-critical tasks and API calls when an order has been marked as 'complete'.

This hook runs for any order that enter a 'completed' status, which include renewals from the Recurring Payments extension. If you only want to include new orders, and not renewals, you will need to check the order status before completing your action.

Code Preview
php
<?php
/*
 * Process non-critical tasks after an order has been completed.
 * 
 * This runs ~30 seconds after a purchase is completed via WP_Cron.
 * 
 * @param int $order_id The Order ID that was marked as completed.
 * @param \EDD\Orders\Order The Order object that was completed.
 * @param EDD_Customer The EDD customer object.
 * 
 * @return void
 */
function eddwp_custom_after_order_actions( $order_id, $order, $customer ) {
	// Perform your custom actions here.
}
add_action( 'edd_after_order_actions', 'eddwp_custom_after_order_actions', 10, 3 );

Comments

Add a Comment