WindCodex ReturnDesk Pro Developer Reference
ReturnDesk Pro uses the same database table, My Account endpoints and base settings as the free plugin - see the free Developer Reference.
Constants
| Constant | Value | Description |
|---|---|---|
RETURNDESK_PRO_VERSION | e.g. '1.0.0' | Current Pro plugin version |
RETURNDESK_PRO_PLUGIN_DIR | absolute path | Plugin directory (with trailing slash) |
RETURNDESK_PRO_PLUGIN_URL | URL | Plugin directory URL |
RETURNDESK_PRO_PLUGIN_BASE | relative path | windcodex-returndesk-pro/windcodex-returndesk-pro.php |
RETURNDESK_SETTINGS_OPTION | 'returndesk_settings' | Option key for all settings |
RETURNDESK_PRO_LICENSE_OPTION | 'returndesk_pro_license_key' | License key option |
RETURNDESK_PRO_LICENSE_STATUS_OPTION | 'returndesk_pro_license_status' | License status option (active / inactive) |
Hooks
It uses WooCommerce's woocommerce_email_header and woocommerce_email_footer to wrap emails.
Actions
| Action | Arguments | Description |
|---|---|---|
returndesk_pro_request_approved | $request_id (int), $request (array) | Fires when a request becomes approved - by a store manager on the Requests tab, or by auto-approval when the customer submits it. ReturnDesk Pro uses it to issue store credit coupons and restock items |
add_action( 'returndesk_pro_request_approved', function ( $request_id, $request ) {
// e.g. notify your warehouse system
}, 10, 2 );The order meta _returndesk_restocked_requests lists the request IDs whose items were already restocked, so each request is restocked only once.
Scheduled event
| Hook | Schedule | Description |
|---|---|---|
returndesk_pro_auto_close_requests | Hourly | Cancels stale pending requests when auto-close is on |
Pro Settings
Stored in returndesk_settings alongside the free keys:
| Key | Default | Description |
|---|---|---|
enable_exchange | yes | Enable exchanges |
exchange_window_days | 7 | Exchange window in days |
return_auto_approve / exchange_auto_approve | no | Auto-approve new requests |
return_allow_partial / exchange_allow_partial | yes | Allow partial requests |
exchange_allow_sale_products | yes | Allow exchanges of sale items |
exchange_reasons | 4 defaults | One reason per line |
exchange_guidelines | Default text | Exchange Guidelines |
auto_restock_approved | no | Add returned quantities back to stock on approval |
refund_to_store_credit | yes | Offer store credit |
refund_to_payment_method | yes | Offer original payment method |
include_shipping_fee_refund | no | Include shipping in store credit |
excluded_category_ids | '' | Comma-separated category IDs |
excluded_product_ids | '' | Comma-separated product IDs |
cod_return_policy | allow | allow or disallow |
whatsapp_number | '' | WhatsApp support number |
auto_close_enabled | no | Enable auto-close |
auto_close_days | 14 | Days before auto-close |
Stored Data
| Where | Key | Description |
|---|---|---|
| Store credit coupon (post meta) | _returndesk_request_id, _returndesk_order_id | Links the coupon to its request and order |
| Replacement order (order meta) | _returndesk_exchange_request_id, _returndesk_exchange_parent_order_id | Links the replacement order to its exchange request and original order |