Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/amirrezashf/woocommerce-customer-order-notes-tracker/archive/refs/heads/main.zipAdds a customer-note count column to WooCommerce My Account orders and tracks unread customer notes per order.
Description
WooCommerce Customer Order Notes Tracker adds a Notes column to the customer orders table in My Account.
For each order, the column displays:
- Total number of customer-visible order notes
- Number of unread notes
- A green unread-notification message
When the order owner opens the WooCommerce view-order page, the current note count is stored as seen.
The plugin uses both a server-side update and a lightweight AJAX confirmation.
Features
- Adds a notes column to My Account orders
- Counts customer-visible WooCommerce notes
- Displays total note count
- Displays unread note count
- Persian digit output
- Marks notes as seen on view-order
- Server-side fallback
- AJAX confirmation
- Order ownership verification
- Nonce-protected AJAX request
- Logged-in users only
- HPOS compatible
- Responsive styling
- No custom database tables
- Single-file plugin
Requirements
- PHP 7.4+
- WordPress 6.0+
- WooCommerce
Installation
- Download the repository as a ZIP file.
- Go to Plugins → Add New Plugin → Upload Plugin.
- Upload the ZIP file.
- Install and activate the plugin.
Usage
No configuration is required.
- Open My Account → Orders.
- Review the new notes column.
- Open an order with unread notes.
- The current customer-note count is marked as seen.
- Return to the orders table; the unread message will no longer appear unless new notes are added.
Counted Notes
Only customer-visible order notes are counted:
'type' => 'customer'
Private administrative notes are excluded.
Unread Calculation
Unread notes = Total customer notes - Seen customer notes
Negative results are normalized to zero.
Data Storage
The plugin stores one user-meta value per user and order.
Example:
_wc_cont_seen_customer_notes_1234
The stored value is the number of customer notes seen for that order.
No custom database tables are created.
Security
- Logged-in user validation
- Order ownership validation
- AJAX nonce verification
- Sanitized order IDs
- WooCommerce order-object validation
- No guest AJAX endpoint
- No direct SQL queries
- No private order-note exposure
HPOS Compatibility
The plugin declares compatibility with WooCommerce High-Performance Order Storage.
Filters
wc_cont_notes_column_label
add_filter(
'wc_cont_notes_column_label',
static function () {
return 'Messages';
}
);
wc_cont_ajax_delay
Changes the AJAX delay in milliseconds.
add_filter(
'wc_cont_ajax_delay',
static function () {
return 500;
}
);
Action Hook
wc_cont_order_notes_marked_seen
add_action(
'wc_cont_order_notes_marked_seen',
static function ( $order_id, $user_id, $total ) {
// Custom integration.
},
10,
3
);
Changelog
1.0.0
- Initial release
- Added My Account notes column
- Added total and unread note counts
- Added server-side seen tracking
- Added AJAX confirmation
- Added ownership and nonce validation
- Added HPOS compatibility
License
GPL-3.0
Author
Amirreza Shayesteh Far
- Website: https://amirrezaa.ir/
- GitHub: https://github.com/amirrezashf
- Repository: https://github.com/amirrezashf/WooCommerce-Customer-Order-Notes-Tracker
رهگیری یادداشتهای سفارش ووکامرس
افزودن ستون تعداد یادداشتها به سفارشهای حساب کاربری ووکامرس و رهگیری یادداشتهای خواندهنشده هر سفارش.
توضیحات
افزونه WooCommerce Customer Order Notes Tracker یک ستون یادداشتها به جدول سفارشهای بخش حساب کاربری اضافه میکند.
برای هر سفارش موارد زیر نمایش داده میشود:
- تعداد کل یادداشتهای قابل مشاهده برای مشتری
- تعداد یادداشتهای خواندهنشده
- پیام سبزرنگ یادداشت جدید
زمانی که مالک سفارش صفحه view-order را باز کند، تعداد فعلی یادداشتها بهعنوان دیدهشده ذخیره میشود.
افزونه برای اطمینان بیشتر از ثبت سروری و تایید سبک AJAX استفاده میکند.
ویژگیها
- افزودن ستون یادداشتها به سفارشهای حساب کاربری
- شمارش یادداشتهای قابل مشاهده برای مشتری
- نمایش تعداد کل یادداشتها
- نمایش تعداد خواندهنشده
- نمایش اعداد فارسی
- ثبت وضعیت دیدهشده در صفحه سفارش
- fallback سروری
- تایید با AJAX
- بررسی مالکیت سفارش
- nonce برای AJAX
- اجرا فقط برای کاربران واردشده
- سازگاری با HPOS
- استایل واکنشگرا
- بدون جدول اختصاصی
- معماری تکفایلی
نیازمندیها
- PHP 7.4+
- WordPress 6.0+
- WooCommerce
نصب
- repository را بهصورت ZIP دانلود کنید.
- وارد افزونهها ← افزودن افزونه تازه ← بارگذاری افزونه شوید.
- فایل ZIP را بارگذاری کنید.
- افزونه را نصب و فعال کنید.
نحوه استفاده
نیازی به تنظیمات اضافی نیست.
- وارد حساب کاربری ← سفارشها شوید.
- ستون یادداشتها را بررسی کنید.
- سفارش دارای یادداشت خواندهنشده را باز کنید.
- تعداد فعلی یادداشتها بهعنوان دیدهشده ثبت میشود.
- پس از بازگشت به لیست سفارشها، پیام خواندهنشده حذف خواهد شد؛ مگر اینکه یادداشت جدیدی ثبت شده باشد.
یادداشتهای شمارششده
فقط یادداشتهای قابل مشاهده برای مشتری شمارش میشوند:
'type' => 'customer'
یادداشتهای خصوصی مدیران در شمارش قرار نمیگیرند.
محاسبه خواندهنشدهها
تعداد خواندهنشده = تعداد کل یادداشتهای مشتری - تعداد دیدهشده
مقادیر منفی به صفر تبدیل میشوند.
ذخیرهسازی داده
برای هر کاربر و سفارش یک user meta ذخیره میشود.
نمونه:
_wc_cont_seen_customer_notes_1234
مقدار ذخیرهشده برابر تعداد یادداشتهای دیدهشده آن سفارش است.
جدول اختصاصی دیتابیس ایجاد نمیشود.
امنیت
- بررسی وارد بودن کاربر
- بررسی مالکیت سفارش
- nonce برای AJAX
- پاکسازی شناسه سفارش
- بررسی order object
- بدون endpoint مهمان
- بدون SQL مستقیم
- عدم نمایش یادداشتهای خصوصی
سازگاری با HPOS
افزونه سازگاری خود را با WooCommerce High-Performance Order Storage اعلام میکند.
فیلترها
wc_cont_notes_column_label
add_filter(
'wc_cont_notes_column_label',
static function () {
return 'پیامها';
}
);
wc_cont_ajax_delay
تغییر تاخیر AJAX بر حسب میلیثانیه:
add_filter(
'wc_cont_ajax_delay',
static function () {
return 500;
}
);
Action Hook
wc_cont_order_notes_marked_seen
add_action(
'wc_cont_order_notes_marked_seen',
static function ( $order_id, $user_id, $total ) {
// اتصال سفارشی.
},
10,
3
);
تغییرات نسخهها
1.0.0
- انتشار اولیه
- افزودن ستون یادداشتها
- نمایش تعداد کل و خواندهنشده
- ثبت سروری وضعیت دیدهشده
- تایید با AJAX
- بررسی مالکیت و nonce
- سازگاری با HPOS
مجوز
GPL-3.0
نویسنده
Amirreza Shayesteh Far
- وبسایت: https://amirrezaa.ir/
- GitHub: https://github.com/amirrezashf
- Repository: https://github.com/amirrezashf/WooCommerce-Customer-Order-Notes-Tracker