add_action('woocommerce_checkout_order_processed', 'send_order_fax');
function send_order_fax($order_id) {
print_r($_REQUEST);
die();
}
I want to grab the order id or order details when this hooks fire so that i can generate a fax. But it is only sending the form data. How can i get the order id so that i can fetch other things via functions.
Thanks
You can get order details using following code:
add_action('woocommerce_checkout_order_processed', 'send_order_fax');
function send_order_fax($order_id) {
$order = new WC_Order( $order_id );
$items = $order->get_items();
print_r($items);
die();
}
in reply to this:
nice , what other things i can grab ? – Raheel Khan
if you use var_dump( $order ); you will see all the information the object is holding.
Edit:
payment method:
get_post_meta( $order->id, '_payment_method', true )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With