WP Manifestindependent plugin directory
manifest / ecommerce / woocommerce-order-refund-details

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

★ 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-order-refund-details/archive/refs/heads/main.zip

A 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

  1. Create a folder named WooCommerce-Order-Refund-Details inside wp-content/plugins/.
  2. Place woocommerce-order-refund-details.php inside that folder.
  3. Activate WooCommerce Order Refund Details from WordPress Plugins.
  4. 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_reasons
  • wcord_request_methods
  • wcord_refund_priorities
  • wcord_sales_call_options
  • wcord_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

نصب

  1. پوشه‌ای با نام WooCommerce-Order-Refund-Details در wp-content/plugins/ بسازید.
  2. فایل woocommerce-order-refund-details.php را داخل آن قرار دهید.
  3. افزونه را از بخش افزونه‌های وردپرس فعال کنید.
  4. یکی از سفارش‌های ووکامرس را در مدیریت باز کنید.

نحوه استفاده

در صفحه ویرایش سفارش، باکس اطلاعات استرداد وجه / واریز به کیف پول نمایش داده می‌شود. اطلاعات موردنیاز را وارد کرده و سفارش را بروزرسانی کنید.

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

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

اطلاعات جدید در 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_reasons
  • wcord_request_methods
  • wcord_refund_priorities
  • wcord_sales_call_options
  • wcord_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