Main Menu
Sub Menu

wpdm_after_checkout – executes after a customer completes checkout

Description


This hook is triggered after payment successfully completed for an order. You may use the hook to send custom instructions for the purchased products to your customer or send a custom order notification email to any email addresses.

Parameters


A registered action function is passed the following parameters.

$order_id
The ID of the order just completed

Usage


<?php add_action("wpdm_after_checkout", "your_function"); ?>

Examples

<?php
add_action("wpdm_after_checkout", "wpdm_send_instructions");
function wpdm_send_instructions($order_id){
    $items = Order::getOrderItems($order_id);    
    $customer = Order::customerInfo($order_id);
    foreach($items as $item){
        $product_id = $item['pid'];
        $params = array(
           'to_email' => $customer['email'],
           'subject' => 'Custom Setup Instructions',
           'message' => 'Your Email Message for Product #'.$product_id,
           );
        \WPDM\Email::send("default", $params); 
    }
}

?>

Related