WooCommerce Order Review Modal
Displays a product review modal on completed WooCommerce order pages.
by Amirreza Shayesteh Far · github.com/amirrezashf/woocommerce-order-review-modal · website
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-order-review-modal/archive/refs/heads/main.zipDisplays a product review modal to customers on eligible WooCommerce order pages.
Description
WooCommerce Order Review Modal asks customers to submit product feedback after completing an order.
The modal is displayed on the WooCommerce View Order page when:
- The customer is logged in
- The order belongs to the current customer
- The order has an eligible status
- No review has already been submitted for the order
- The customer has not permanently disabled the modal
For variation products, the review is always attached to the parent product.
Features
- Displays a review modal on completed order pages
- Verifies order ownership
- Supports variable products
- Registers reviews on parent products
- Supports multiple products in one order
- Optional rating from 1 to 5
- Minimum review content validation
- Prevents duplicate submissions per order
- Permanently disable modal per order
- Responsive modal design
- AJAX review submission
- Nonce and permission validation
- HPOS compatible
- Single-file architecture
Requirements
- PHP 7.4+
- WordPress 6.0+
- WooCommerce 7.0+
Installation
- Create a folder named:
woocommerce-order-review-modal
- Place the following file inside the folder:
woocommerce-order-review-modal.php
- Upload the folder to:
wp-content/plugins/
- Activate the plugin from the WordPress admin panel.
Usage
After activation, the plugin works automatically.
By default, the review modal appears for orders with the completed status when the customer opens the order details page in My Account.
The customer can:
- Select a product from the order
- Choose an optional rating
- Submit a written review
- Close the modal temporarily
- Disable the modal permanently for that order
Review Storage
Submitted reviews are stored as standard WordPress comments with the review comment type.
The following comment meta values may be stored:
rating
verified
order_id
The plugin also stores order metadata to track modal state:
_wc_orm_review_completed
_wc_orm_modal_disabled
_wc_orm_review_product_id
_wc_orm_review_comment_id
Filters
wc_orm_allowed_order_statuses
Change the eligible order statuses.
Statuses must be provided without the wc- prefix.
add_filter(
'wc_orm_allowed_order_statuses',
static function () {
return array(
'processing',
'completed',
);
}
);
wc_orm_minimum_comment_length
Change the minimum review length.
add_filter(
'wc_orm_minimum_comment_length',
static function () {
return 10;
}
);
wc_orm_review_approval_status
Send reviews to moderation instead of approving them immediately.
add_filter(
'wc_orm_review_approval_status',
static function () {
return 0;
}
);
wc_orm_is_order_eligible
Customize order eligibility.
add_filter(
'wc_orm_is_order_eligible',
static function ( $eligible, $order, $user_id ) {
return $eligible;
},
10,
3
);
wc_orm_product_options
Modify the products displayed in the modal.
add_filter(
'wc_orm_product_options',
static function ( $products, $order ) {
return $products;
},
10,
2
);
Data Storage
The plugin does not create custom database tables.
It uses:
- WordPress comments for product reviews
- Comment meta for rating and order information
- WooCommerce order meta for modal state
Security
The plugin includes:
- Nonce validation
- Logged-in user validation
- Order ownership verification
- Order status validation
- Product-in-order validation
- Input sanitization
- Output escaping
- Duplicate submission prevention
Development
Built using:
- WordPress Coding Standards
- WooCommerce CRUD APIs
- WooCommerce order objects
- WordPress Comments API
- WordPress AJAX API
- Native JavaScript
- Translation-ready strings
- HPOS-compatible architecture
License
GPL-3.0
Author
Amirreza Shayesteh Far
GitHub: https://github.com/amirrezashf
مودال ثبت نظر سفارش ووکامرس
نمایش مودال ثبت دیدگاه محصول برای مشتریان در صفحه سفارشهای واجد شرایط ووکامرس.
توضیحات
افزونه WooCommerce Order Review Modal پس از تکمیل سفارش، از مشتری میخواهد تجربه خود از خرید و محصول را ثبت کند.
مودال در صفحه مشاهده سفارش نمایش داده میشود، بهشرط اینکه:
- کاربر وارد حساب خود شده باشد
- سفارش متعلق به همان کاربر باشد
- وضعیت سفارش مجاز باشد
- قبلاً برای سفارش نظر ثبت نشده باشد
- کاربر مودال را برای آن سفارش برای همیشه نبسته باشد
در محصولات variation، دیدگاه همیشه روی محصول والد ثبت میشود.
ویژگیها
- نمایش مودال در صفحه سفارش تکمیلشده
- بررسی مالکیت سفارش
- پشتیبانی از محصولات متغیر
- ثبت نظر روی محصول والد
- پشتیبانی از سفارشهای چندمحصولی
- امتیازدهی اختیاری از ۱ تا ۵
- اعتبارسنجی حداقل طول دیدگاه
- جلوگیری از ثبت تکراری
- امکان بستن دائمی برای هر سفارش
- طراحی responsive
- ثبت دیدگاه با AJAX
- بررسی nonce و دسترسی
- سازگار با HPOS
- معماری تکفایلی
نیازمندیها
- PHP 7.4+
- WordPress 6.0+
- WooCommerce 7.0+
نصب
- پوشهای با نام زیر بسازید:
woocommerce-order-review-modal
- فایل زیر را داخل آن قرار دهید:
woocommerce-order-review-modal.php
- پوشه را در مسیر زیر آپلود کنید:
wp-content/plugins/
- افزونه را از پنل وردپرس فعال کنید.
نحوه استفاده
پس از فعالسازی، افزونه بهصورت خودکار کار میکند.
بهصورت پیشفرض، مودال فقط برای سفارشهایی با وضعیت completed در صفحه جزئیات سفارش حساب کاربری نمایش داده میشود.
مشتری میتواند:
- یکی از محصولات سفارش را انتخاب کند
- امتیاز اختیاری ثبت کند
- دیدگاه متنی ارسال کند
- مودال را موقتاً ببندد
- مودال را برای آن سفارش برای همیشه غیرفعال کند
ذخیرهسازی اطلاعات
دیدگاهها بهصورت comment استاندارد وردپرس با نوع review ذخیره میشوند.
comment metaهای زیر ممکن است ذخیره شوند:
rating
verified
order_id
وضعیت مودال نیز با order metaهای زیر ذخیره میشود:
_wc_orm_review_completed
_wc_orm_modal_disabled
_wc_orm_review_product_id
_wc_orm_review_comment_id
فیلترها
wc_orm_allowed_order_statuses
تغییر وضعیتهای مجاز سفارش:
add_filter(
'wc_orm_allowed_order_statuses',
static function () {
return array(
'processing',
'completed',
);
}
);
wc_orm_minimum_comment_length
تغییر حداقل طول دیدگاه:
add_filter(
'wc_orm_minimum_comment_length',
static function () {
return 10;
}
);
wc_orm_review_approval_status
ارسال دیدگاهها برای تأیید مدیر:
add_filter(
'wc_orm_review_approval_status',
static function () {
return 0;
}
);
ذخیرهسازی داده
افزونه جدول اختصاصی ایجاد نمیکند.
برای ذخیره اطلاعات از موارد زیر استفاده میشود:
- WordPress comments برای دیدگاه محصول
- Comment meta برای امتیاز و اطلاعات سفارش
- WooCommerce order meta برای وضعیت مودال
امنیت
افزونه شامل موارد زیر است:
- بررسی nonce
- بررسی ورود کاربر
- بررسی مالکیت سفارش
- بررسی وضعیت سفارش
- بررسی وجود محصول در سفارش
- sanitize کردن ورودیها
- escape کردن خروجیها
- جلوگیری از ثبت تکراری
مجوز
GPL-3.0
نویسنده
Amirreza Shayesteh Far
GitHub: https://github.com/amirrezashf