WindCodex ReturnDesk Developer Reference
Constants
| Constant | Value | Description |
|---|---|---|
RETURNDESK_VERSION | e.g. '1.0.4' | Current plugin version |
RETURNDESK_PLUGIN_FILE | absolute path | Main plugin file |
RETURNDESK_PLUGIN_DIR | absolute path | Plugin directory (with trailing slash) |
RETURNDESK_PLUGIN_URL | URL | Plugin directory URL (with trailing slash) |
RETURNDESK_PLUGIN_BASE | relative path | windcodex-returndesk/windcodex-returndesk.php |
RETURNDESK_SETTINGS_OPTION | 'returndesk_settings' | Option key for all settings |
Hooks
| Hook | Type | Description |
|---|---|---|
returndesk_before_settings | Action | Fires at the top of the ReturnDesk settings page |
ReturnDesk also uses WooCommerce's woocommerce_email_header and woocommerce_email_footer actions to wrap its emails.
My Account Endpoints
| Endpoint | Description |
|---|---|
returndesk-requests | The Returns tab listing the customer's requests |
returndesk-returns | "Start a return" page for choosing an order to return |
Options
All settings are stored in the returndesk_settings option. Main keys:
| Key | Type | Default | Description |
|---|---|---|---|
enable_returns | yes/no | yes | Master toggle |
return_window_days | int | 7 | Return window in days |
allowed_statuses | array | ['completed', 'processing'] | Eligible order statuses |
return_allow_sale_products | yes/no | yes | Allow returns of sale items |
return_reasons | string | 4 defaults | One reason per line |
return_guidelines | string (HTML) | Default guidelines | Return Guidelines |
terms_page_id | int | 0 | Terms & Conditions page ID |
customer_message | string | Default message | Customer Success Message |
return_store_address_1 … return_store_phone | string | Store address | Return address fields |
admin_notification_email | string | '' | Admin notification address (blank = site admin email) |
email_enable_*, email_subject_*, email_heading_*, email_body_*, email_items_title_*, email_additional_content_* | string | Defaults | Email template settings |
Other options: returndesk_requests_table_version (database table version).
Database Table
Table: {prefix}returndesk_requests
| Column | Type | Description |
|---|---|---|
id | bigint AUTO_INCREMENT | Request ID |
order_id | bigint | WooCommerce order ID |
customer_id | bigint (nullable) | WordPress user ID (empty for guests) |
guest_email | varchar (nullable) | Billing email for guest requests |
request_type | varchar | return |
status | varchar | pending / approved / rejected / cancelled |
reason | text | Reason and customer message |
items_json | longtext | JSON list of requested items and quantities |
attachment_ids_json | longtext | JSON list of attachment IDs |
refund_method | varchar | Refund method (used by Pro) |
created_at | datetime | Submission time |
updated_at | datetime | Last update time |