Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //If you want to get Product id from order id in Woocommerce then fetch order details.
- $order = new WC_Order( $order_id );
- $items = $order->get_items();
- //then if you loop through them, you can get all the relevant data:
- foreach ( $items as $item ) {
- $product_name = $item['name'];
- $product_id = $item['product_id'];
- $product_variation_id = $item['variation_id'];
- }
Add Comment
Please, Sign In to add comment