woocommerce_order_status_completed
- by admin
- 0
Using this filter, we can add code that should be executed after woocommerce order is completed.
add_action(‘woocommerce_order_status_completed’, ‘complte_order_process_function’);
function complte_order_process_function($order_id){
$order_user_details = new WC_Order($order_id);
file_put_contents(‘myfile.txt’,print_r($order_user_details, true));
// Ordered customer details
$customer = get_userdata($order_user_details->customer_user);
// Ordered product details
$items_total = $ order_user_details ->get_items();
}
Using this filter, we can add code that should be executed after woocommerce order is completed. add_action(‘woocommerce_order_status_completed’, ‘complte_order_process_function’); function complte_order_process_function($order_id){ $order_user_details = new WC_Order($order_id); file_put_contents(‘myfile.txt’,print_r($order_user_details, true)); // Ordered customer details $customer = get_userdata($order_user_details->customer_user); // Ordered product details $items_total = $ order_user_details ->get_items(); }
Using this filter, we can add code that should be executed after woocommerce order is completed. add_action(‘woocommerce_order_status_completed’, ‘complte_order_process_function’); function complte_order_process_function($order_id){ $order_user_details = new WC_Order($order_id); file_put_contents(‘myfile.txt’,print_r($order_user_details, true)); // Ordered customer details $customer = get_userdata($order_user_details->customer_user); // Ordered product details $items_total = $ order_user_details ->get_items(); }