North Return Manager hooks
These hooks let you react to returns, adjust the return rules and connect North Return Manager to the rest of your shop. To connect a shipping service, see Return carriers.
Loading
north_return_manager_loaded (action)
Fires when North Return Manager is ready. Register carriers and other extensions here, so your plugin keeps working when North Return Manager is not installed.
| Parameter | Type | Description |
|---|---|---|
$api | int | The extension API version, currently 1 |
The return object
Hooks pass a \NorthReturnManager\ReturnRequest. Read from it; change returns only through the plugin’s own screens and actions.
| Property or method | Description |
|---|---|
$r->id, $r->order_id, $r->customer_id | Ids |
$r->status | Current status, see below |
$r->number() | The return number shown to the customer, for example R-1042 |
$r->type(), $r->is_complaint() | Return or complaint |
$r->order() | The WC_Order, or null |
$r->items() | The returned items |
$r->resolution_label() | Refund, exchange or store credit, as text |
$r->carrier, $r->tracking | Return shipping, when booked |
$r->view_url() | The customer’s page for the return |
Statuses: requested, approved, rejected, in_transit, received, completed, cancelled.
Events
north_return_manager_created (action)
A customer, or the shop on their behalf, created a return.
| Parameter | Type | Description |
|---|---|---|
$r | ReturnRequest | The return |
// Tell the warehouse system that a return is on its way.
add_action( 'north_return_manager_created', function ( $r ) {
my_wms_expect_return( $r->number(), $r->order_id );
} );
north_return_manager_status_changed (action)
A return changed status.
| Parameter | Type | Description |
|---|---|---|
$r | ReturnRequest | The return |
$from | string | The previous status |
$to | string | The new status |
north_return_manager_parcel_arrived (action)
The return parcel has been delivered to the shop and is waiting to be received and checked.
| Parameter | Type | Description |
|---|---|---|
$r | ReturnRequest | The return |
north_return_manager_deviation_answered (action)
The customer answered a request to approve a higher return shipping deduction.
| Parameter | Type | Description |
|---|---|---|
$r | ReturnRequest | The return |
$accept | bool | Whether the customer approved |
north_return_manager_deleted (action)
A return is about to be deleted, together with its files.
| Parameter | Type | Description |
|---|---|---|
$r | ReturnRequest | The return |
Return rules
north_return_manager_order_statuses (filter)
The order statuses where returns can be requested. Default: completed and processing.
| Parameter | Type | Description |
|---|---|---|
$statuses | string[] | Statuses without the wc- prefix |
north_return_manager_complaint_days (filter)
How many days after delivery a complaint can be made. Default: three years (1 095 days), the Swedish consumer complaint period.
| Parameter | Type | Description |
|---|---|---|
$days | int | Days |
north_return_manager_item_blocked (filter)
Blocks a single order item from being returned. Return a reason to block it; the customer sees the reason.
| Parameter | Type | Description |
|---|---|---|
$reason | string | '' means the item can be returned |
$item | WC_Order_Item_Product | The order item |
// Gift cards cannot be returned.
add_filter( 'north_return_manager_item_blocked', function ( string $reason, WC_Order_Item_Product $item ) {
$product = $item->get_product();
if ( '' === $reason && $product && has_term( 'gift-cards', 'product_cat', $product->get_id() ) ) {
return __( 'Gift cards cannot be returned.', 'my-plugin' );
}
return $reason;
}, 10, 2 );
north_return_manager_exchange_options (filter)
What an item can be exchanged for. Default: the same item again and the other variations of the same product that are in stock and have the same price.
| Parameter | Type | Description |
|---|---|---|
$options | array<int,string> | Product id => label |
$item | WC_Order_Item_Product | The order item |
north_return_manager_delivered_at (filter)
When the order was delivered, as a Unix timestamp. Shipping plugins use it so that Create return appears in the order list as soon as the parcel is delivered, even before the order is marked completed. Return 0 when unknown.
| Parameter | Type | Description |
|---|---|---|
$timestamp | int | Delivery time, or 0 |
$order | WC_Order | The order |
Integration
north_return_manager_find_order (filter)
Finds an order in the guest return form when your shop uses custom order numbers. Return the order, or null to let the plugin search.
| Parameter | Type | Description |
|---|---|---|
$order | WC_Order|null | The order, if already found |
$number | string | The order number the customer typed |
north_return_manager_host (filter)
Lets a shipping plugin host the Returns menu and settings inside its own menu. Without a host, Returns sits under WooCommerce.
| Key | Description |
|---|---|
menu_parent | The parent menu slug |
menu_position | The position in that menu |
settings_url | Where the return settings are |
north_return_manager_media_dir (filter)
The folder where photos and videos from customers are stored. Default: a private folder in the uploads directory with random file names. If you move it, keep it outside the public web root or protected from direct access.
| Parameter | Type | Description |
|---|---|---|
$dir | string | Absolute path with a trailing slash |
