Documentation
ReturnDesk Pro
Developer Reference

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

ConstantValueDescription
RETURNDESK_PRO_VERSIONe.g. '1.0.0'Current Pro plugin version
RETURNDESK_PRO_PLUGIN_DIRabsolute pathPlugin directory (with trailing slash)
RETURNDESK_PRO_PLUGIN_URLURLPlugin directory URL
RETURNDESK_PRO_PLUGIN_BASErelative pathwindcodex-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

ActionArgumentsDescription
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

HookScheduleDescription
returndesk_pro_auto_close_requestsHourlyCancels stale pending requests when auto-close is on

Pro Settings

Stored in returndesk_settings alongside the free keys:

KeyDefaultDescription
enable_exchangeyesEnable exchanges
exchange_window_days7Exchange window in days
return_auto_approve / exchange_auto_approvenoAuto-approve new requests
return_allow_partial / exchange_allow_partialyesAllow partial requests
exchange_allow_sale_productsyesAllow exchanges of sale items
exchange_reasons4 defaultsOne reason per line
exchange_guidelinesDefault textExchange Guidelines
auto_restock_approvednoAdd returned quantities back to stock on approval
refund_to_store_credityesOffer store credit
refund_to_payment_methodyesOffer original payment method
include_shipping_fee_refundnoInclude shipping in store credit
excluded_category_ids''Comma-separated category IDs
excluded_product_ids''Comma-separated product IDs
cod_return_policyallowallow or disallow
whatsapp_number''WhatsApp support number
auto_close_enablednoEnable auto-close
auto_close_days14Days before auto-close

Stored Data

WhereKeyDescription
Store credit coupon (post meta)_returndesk_request_id, _returndesk_order_idLinks the coupon to its request and order
Replacement order (order meta)_returndesk_exchange_request_id, _returndesk_exchange_parent_order_idLinks the replacement order to its exchange request and original order