function oir_generate_report($from, $to) { if (!function_exists('wc_get_orders')) { echo "

WooCommerce not active

"; return; } $orders = wc_get_orders([ 'limit' => -1, 'status' => ['wc-processing', 'wc-on-hold'], 'date_created' => $from . '...' . $to, ]); if (!$orders) { echo "

No orders found

"; return; } $items_data = []; foreach ($orders as $order) { $order_id = $order->get_id(); foreach ($order->get_items() as $item) { $product = $item->get_product(); if (!$product) continue; $product_id = $product->get_id(); $product_name = $item->get_name(); $qty = $item->get_quantity(); // Image $image = ''; if ($product->get_image_id()) { $image = wp_get_attachment_image($product->get_image_id(), [40, 40]); } if (!isset($items_data[$product_id])) { $items_data[$product_id] = [ 'name' => $product_name, 'qty' => 0, 'image' => $image, 'orders' => [] ]; } $items_data[$product_id]['qty'] += $qty; // ✅ collect order IDs $items_data[$product_id]['orders'][$order_id] = $order_id; } } if (empty($items_data)) { echo "

No items found

"; return; } // Sort uasort($items_data, function ($a, $b) { return $b['qty'] - $a['qty']; }); echo "

Report from {$from} to {$to}

"; echo ""; echo ""; foreach ($items_data as $product_id => $data) { $order_ids = implode(', ', $data['orders']); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
Image Product ID Product Order IDs Total Quantity
{$data['image']}{$product_id}" . esc_html($data['name']) . "{$order_ids}{$data['qty']}
"; } LAKSHMI BANGLE MF3091 – Mahi Fashions

Mahi Fashions

Lightweight, Stylish, and Perfect for Daily wear

Lightweight, Stylish, and Perfect for Daily wear

Mahi Fashions - Shop

LAKSHMI BANGLE MF3091

250.00

SKU: N/A Categories: ,

Additional information

Size

2.4, 2.6, 2.8

Reviews

There are no reviews yet.

Be the first to review “LAKSHMI BANGLE MF3091”

Your email address will not be published. Required fields are marked *

×
Your Cart
2,000.00
Shipping & taxes may be re-calculated at checkout
2,120.00