WP Manifestindependent plugin directory
manifest / ecommerce / woocommerce-top-customers-by-order-status

WooCommerce Top Customers by Order Status

Reports WooCommerce customers with the highest number of orders in a selected order status.

by Amirreza Shayesteh Far · github.com/amirrezashf/woocommerce-top-customers-by-order-status · website

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/amirrezashf/woocommerce-top-customers-by-order-status/archive/refs/heads/main.zip

Reports registered WooCommerce customers with the highest number of orders in a selected order status.

Description

WooCommerce Top Customers by Order Status adds a reporting page under the WooCommerce admin menu.

Store managers can select any registered WooCommerce order status and view customers ranked by the number of orders they have in that status.

The report includes:

  • Customer name
  • User ID
  • Email address
  • Number of matching orders
  • User edit link
  • Customer order list link

The plugin uses WooCommerce order query APIs instead of direct queries against WordPress order tables, allowing it to work with both legacy order storage and WooCommerce HPOS.

Features

  • Reports customers by selected order status
  • Supports standard and custom order statuses
  • Sorts customers by order count
  • Configurable maximum result rows
  • Excludes guest orders
  • Includes customer profile links
  • Includes filtered WooCommerce order links
  • Processes orders in batches
  • Configurable scan safety limit
  • Compatible with WooCommerce HPOS
  • No custom database tables
  • Single-file plugin

Requirements

  • PHP 7.4+
  • WordPress 6.0+
  • WooCommerce

Installation

  1. Download the repository as a ZIP file.
  2. In WordPress, open Plugins → Add New Plugin → Upload Plugin.
  3. Select the downloaded ZIP file.
  4. Install and activate the plugin.

Usage

After activation:

  1. Open WooCommerce → Top Customers.
  2. Select an order status.
  3. Choose the maximum number of customers to display.
  4. Select Apply Filter.

Only orders connected to registered WordPress users are counted. Guest orders are excluded.

Performance

Orders are processed in batches instead of being loaded all at once.

Default values:

  • Query batch size: 250
  • Maximum scanned orders per report: 10,000
  • Maximum displayed customers: 500

When the number of matching orders exceeds the scan limit, an admin warning is displayed.

Data Storage

The plugin does not create custom database tables and does not store report results.

Reports are calculated when the admin page is loaded.

Filters

wc_tcos_required_capability

Changes the capability required to access the report.

add_filter(
    'wc_tcos_required_capability',
    static function () {
        return 'manage_options';
    }
);

wc_tcos_query_batch_size

Changes the number of orders processed in each query.

add_filter(
    'wc_tcos_query_batch_size',
    static function () {
        return 500;
    }
);

wc_tcos_maximum_scan_orders

Changes the maximum number of orders processed in one report.

add_filter(
    'wc_tcos_maximum_scan_orders',
    static function () {
        return 25000;
    }
);

wc_tcos_report_rows

Modifies the final report rows.

add_filter(
    'wc_tcos_report_rows',
    static function ( $rows, $status, $limit ) {
        return $rows;
    },
    10,
    3
);

HPOS Compatibility

The plugin declares compatibility with WooCommerce High-Performance Order Storage.

Order data is retrieved using WooCommerce CRUD and order query APIs rather than direct SQL queries against wp_posts or wp_postmeta.

License

GPL-3.0

Author

Amirreza Shayesteh Far


گزارش کاربران پرتعداد ووکامرس بر اساس وضعیت سفارش

نمایش کاربران ثبت‌نام‌شده‌ای که بیشترین تعداد سفارش را در یک وضعیت مشخص دارند.

توضیحات

افزونه WooCommerce Top Customers by Order Status یک صفحه گزارش به منوی ووکامرس اضافه می‌کند.

مدیر فروشگاه می‌تواند یکی از وضعیت‌های سفارش را انتخاب کند و کاربران را بر اساس تعداد سفارش‌هایشان در آن وضعیت مشاهده کند.

گزارش شامل اطلاعات زیر است:

  • نام مشتری
  • شناسه کاربر
  • ایمیل
  • تعداد سفارش‌ها
  • لینک ویرایش کاربر
  • لینک مشاهده سفارش‌های مشتری

این افزونه به‌جای query مستقیم روی جدول‌های سفارش وردپرس، از API سفارش‌های ووکامرس استفاده می‌کند و با سیستم قدیمی ذخیره سفارش و WooCommerce HPOS سازگار است.

ویژگی‌ها

  • گزارش کاربران بر اساس وضعیت سفارش
  • پشتیبانی از وضعیت‌های استاندارد و سفارشی
  • مرتب‌سازی بر اساس تعداد سفارش
  • تعیین حداکثر تعداد کاربران
  • حذف سفارش‌های مهمان از گزارش
  • لینک مستقیم پروفایل مشتری
  • لینک مشاهده سفارش‌های مشتری
  • پردازش سفارش‌ها به‌صورت batch
  • محدودیت ایمنی برای تعداد سفارش‌های بررسی‌شده
  • سازگار با WooCommerce HPOS
  • بدون جدول اختصاصی دیتابیس
  • معماری تک‌فایلی

نیازمندی‌ها

  • PHP 7.4+
  • WordPress 6.0+
  • WooCommerce

نصب

  1. repository را به‌صورت ZIP دانلود کنید.
  2. در وردپرس وارد افزونه‌ها ← افزودن افزونه تازه ← بارگذاری افزونه شوید.
  3. فایل ZIP را انتخاب کنید.
  4. افزونه را نصب و فعال کنید.

نحوه استفاده

پس از فعال‌سازی:

  1. وارد ووکامرس ← کاربران پرتعداد شوید.
  2. وضعیت سفارش را انتخاب کنید.
  3. حداکثر تعداد کاربران را مشخص کنید.
  4. روی اعمال فیلتر بزنید.

فقط سفارش‌های متصل به کاربران ثبت‌نام‌شده شمارش می‌شوند و سفارش‌های مهمان در گزارش قرار نمی‌گیرند.

عملکرد و منابع

سفارش‌ها به‌صورت batch پردازش می‌شوند و همه سفارش‌ها به‌صورت هم‌زمان در حافظه قرار نمی‌گیرند.

مقادیر پیش‌فرض:

  • تعداد سفارش در هر query: ۲۵۰
  • حداکثر سفارش بررسی‌شده: ۱۰٬۰۰۰
  • حداکثر کاربر قابل نمایش: ۵۰۰

اگر تعداد سفارش‌های وضعیت انتخاب‌شده از سقف اسکن بیشتر باشد، یک هشدار در صفحه مدیریت نمایش داده می‌شود.

ذخیره‌سازی داده

افزونه جدول اختصاصی ایجاد نمی‌کند و نتیجه گزارش را نیز ذخیره نمی‌کند.

گزارش هنگام باز شدن صفحه مدیریت محاسبه می‌شود.

فیلترها

wc_tcos_required_capability

تغییر capability لازم برای مشاهده گزارش:

add_filter(
    'wc_tcos_required_capability',
    static function () {
        return 'manage_options';
    }
);

wc_tcos_query_batch_size

تغییر تعداد سفارش پردازش‌شده در هر query:

add_filter(
    'wc_tcos_query_batch_size',
    static function () {
        return 500;
    }
);

wc_tcos_maximum_scan_orders

تغییر سقف سفارش‌های بررسی‌شده:

add_filter(
    'wc_tcos_maximum_scan_orders',
    static function () {
        return 25000;
    }
);

wc_tcos_report_rows

تغییر ردیف‌های نهایی گزارش:

add_filter(
    'wc_tcos_report_rows',
    static function ( $rows, $status, $limit ) {
        return $rows;
    },
    10,
    3
);

سازگاری با HPOS

افزونه سازگاری خود را با WooCommerce High-Performance Order Storage اعلام می‌کند.

برای دریافت سفارش‌ها از WooCommerce CRUD و Order Query API استفاده می‌شود و query مستقیمی روی wp_posts یا wp_postmeta انجام نمی‌شود.

مجوز

GPL-3.0

نویسنده

Amirreza Shayesteh Far