Answer the question
In order to leave comments, you need to log in
Send idorder after checkout to external server?
Try to do it like this:
add_action( 'woocommerce_create_order', 'so_woocommerce_create_order' );
function so_woocommerce_create_order( $order_id ){
$order = wc_get_order( $order_id );
$url = ' site.ru/savehook.php ';
wp_remote_post( $url, array(
'method' => 'POST',
'timeout' => 45,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' = > array(),
'body' => array('order'=>$order),
'cookies' => array()
)
);
}
But the data is not returned to me.
Did I choose the right action? I tried both the name of the hook for adding an order, and using actions from the api, but maybe I'm wrong.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question