WooCommerce Order Refund Details
Add a secure HPOS-compatible admin panel for recording WooCommerce order refund details, priorities, follow-up requirements, and change history.
by Amirreza Shayesteh Far · github.com/amirrezashf/woocommerce-order-refund-details · 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-refund-details/archive/refs/heads/main.zipA lightweight WooCommerce admin plugin for recording refund or wallet-credit details directly on the order edit screen.
Features
- Adds a dedicated refund details metabox to WooCommerce orders.
- Supports both HPOS and legacy order storage.
- Uses WooCommerce CRUD APIs for order metadata.
- Provides a reduced, formal set of cancellation/refund reasons.
- Records request source, refund amount, destination card number, cardholder name, refund priority, and sales follow-up requirement.
- Keeps a bounded change history with administrator name, date, and changed fields.
- Includes nonce verification, capability checks, input sanitization, and server-side validation.
- Reads historical metadata created by the original snippet and migrates individual fields when they are changed.
Requirements
- WordPress 6.0+
- PHP 7.4+
- WooCommerce
Installation
- Create a folder named
WooCommerce-Order-Refund-Detailsinsidewp-content/plugins/. - Place
woocommerce-order-refund-details.phpinside that folder. - Activate WooCommerce Order Refund Details from WordPress Plugins.
- Open a WooCommerce order in the admin area.
Usage
The plugin adds an Refund / Wallet Credit Details panel to the order edit screen. Complete the required operational information and update the order to save changes.
Saving these fields does not automatically change the WooCommerce order status.
Data Storage
New data is stored as internal WooCommerce order metadata:
_wcord_cancel_reason_wcord_request_method_wcord_refund_amount_wcord_card_number_wcord_cardholder_name_wcord_refund_priority_wcord_need_sales_call_wcord_update_logs
Historical keys from the original snippet are read as fallbacks. When a field is intentionally changed, its old key is removed and the value is stored under the new internal key.
Hooks / Filters
wcord_cancel_reasonswcord_request_methodswcord_refund_prioritieswcord_sales_call_optionswcord_manage_refund_details_capability
Security
The metabox is limited to users with the manage_woocommerce capability by default. Save operations require a valid nonce and server-side validation.
The plugin stores the destination card number as order metadata when entered. Treat this information as sensitive operational data and restrict order-admin access appropriately.
Compatibility
- WooCommerce legacy order storage: supported
- WooCommerce HPOS: supported
- Frontend/checkout changes: none
License
GPL-3.0
Author
Amirreza Shayesteh Far
https://github.com/amirrezashf
اطلاعات استرداد وجه سفارش ووکامرس
افزونهای سبک برای ثبت اطلاعات لغو، استرداد وجه یا واریز به کیف پول در صفحه مدیریت سفارش ووکامرس.
قابلیتها
- افزودن باکس اختصاصی اطلاعات استرداد به صفحه سفارش.
- سازگار با HPOS و ساختار قدیمی سفارشهای ووکامرس.
- استفاده از WooCommerce CRUD API برای اطلاعات سفارش.
- کاهش علتهای لغو به چند دسته رسمی و کاربردی.
- ثبت مسیر درخواست، مبلغ استرداد، شماره کارت مقصد، نام دارنده کارت، اولویت و نیاز به پیگیری واحد فروش.
- ثبت تاریخچه تغییرات شامل نام مدیر، زمان و فیلدهای تغییریافته.
- استفاده از Nonce، Capability Check، Sanitization و Validation سمت سرور.
- پشتیبانی از دادههای قبلی کد اولیه و مهاجرت تدریجی هر فیلد پس از تغییر.
نیازمندیها
- WordPress 6.0+
- PHP 7.4+
- WooCommerce
نصب
- پوشهای با نام
WooCommerce-Order-Refund-Detailsدرwp-content/plugins/بسازید. - فایل
woocommerce-order-refund-details.phpرا داخل آن قرار دهید. - افزونه را از بخش افزونههای وردپرس فعال کنید.
- یکی از سفارشهای ووکامرس را در مدیریت باز کنید.
نحوه استفاده
در صفحه ویرایش سفارش، باکس اطلاعات استرداد وجه / واریز به کیف پول نمایش داده میشود. اطلاعات موردنیاز را وارد کرده و سفارش را بروزرسانی کنید.
ذخیره این فرم بهصورت خودکار وضعیت سفارش ووکامرس را تغییر نمیدهد.
ساختار ذخیرهسازی
اطلاعات جدید در Order Metaهای داخلی زیر ذخیره میشوند:
_wcord_cancel_reason_wcord_request_method_wcord_refund_amount_wcord_card_number_wcord_cardholder_name_wcord_refund_priority_wcord_need_sales_call_wcord_update_logs
کلیدهای قدیمی کد اولیه برای سفارشهای قبلی بهصورت fallback خوانده میشوند. با تغییر هر فیلد، همان فیلد به کلید جدید منتقل میشود.
فیلترها
wcord_cancel_reasonswcord_request_methodswcord_refund_prioritieswcord_sales_call_optionswcord_manage_refund_details_capability
امنیت
بهصورت پیشفرض فقط کاربران دارای Capability برابر manage_woocommerce به این باکس دسترسی دارند و ذخیره اطلاعات با Nonce و اعتبارسنجی سمت سرور محافظت میشود.
شماره کارت مقصد در صورت ثبت شدن بهعنوان Order Meta ذخیره میشود؛ بنابراین دسترسی به مدیریت سفارشها باید فقط در اختیار کاربران مجاز باشد.
سازگاری
- WooCommerce Legacy Order Storage: پشتیبانی میشود
- WooCommerce HPOS: پشتیبانی میشود
- تغییری در Checkout یا Frontend ایجاد نمیشود
مجوز
GPL-3.0
نویسنده
Amirreza Shayesteh Far
https://github.com/amirrezashf