I have made a function for when the WooCommerce order payment is successful.
add_action( 'woocommerce_payment_complete', 'do_it' );
function do_it( $order_id ){
// Here will run the function
$order_id="//I want the order id here of woocommerce";
$order = wc_get_order( $order_id ); //Then I can get order details from here
}
How Can I get $order_id here with this hook?
2
Answers
You already have the order ID in your function as the parameter.
Try with this.