:::: MENU ::::

WooCommerce get order product detail programatically

WooCommerce get order product detail programatically

Today we talk about how to get WooCommerce order product or item detail programmatically. Sometimes you need to get order product or item information regarding some tweak or change the quantity or any other kind of customization. So let start with our example.

        $orderId = 10;
        $orderDetail = new WC_Order( $order_id );
        $orderItems = $orderDetail->get_items();
        foreach ( $orderItems as $orderItem ) {
            $productId = $orderItem['product_id'];
            $productQuantity = $orderItem['qty'];
        }
Author: Qaisar Satti
Category: WooCommerce
Last Modified: January 21, 2021


Comments are closed.