trigger when order placed
-
I want a trigger action when order is placed, in order to fetch order data.
i used this action :
add_action( ‘woocommerce_new_order’, ‘myfunction’, 1, 1 );
function myfunction( $order_id ) {
$order = new WC_Order( $order_id );
$items = $order->get_items();
foreach ( $order->get_items() as $item_key => $item ) {$product = $order->get_product_from_item( $item );
$sku3 = $product->get_sku();
// print_r( $item );
}but doesen’t fetch product detail, only customer details are visable.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘trigger when order placed’ is closed to new replies.