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.

ParameterTypeDescription
$apiintThe 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 methodDescription
$r->id, $r->order_id, $r->customer_idIds
$r->statusCurrent 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->trackingReturn 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.

ParameterTypeDescription
$rReturnRequestThe 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.

ParameterTypeDescription
$rReturnRequestThe return
$fromstringThe previous status
$tostringThe 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.

ParameterTypeDescription
$rReturnRequestThe return

north_return_manager_deviation_answered (action)

The customer answered a request to approve a higher return shipping deduction.

ParameterTypeDescription
$rReturnRequestThe return
$acceptboolWhether the customer approved

north_return_manager_deleted (action)

A return is about to be deleted, together with its files.

ParameterTypeDescription
$rReturnRequestThe return

Return rules

north_return_manager_order_statuses (filter)

The order statuses where returns can be requested. Default: completed and processing.

ParameterTypeDescription
$statusesstring[]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.

ParameterTypeDescription
$daysintDays

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.

ParameterTypeDescription
$reasonstring'' means the item can be returned
$itemWC_Order_Item_ProductThe 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.

ParameterTypeDescription
$optionsarray<int,string>Product id => label
$itemWC_Order_Item_ProductThe 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.

ParameterTypeDescription
$timestampintDelivery time, or 0
$orderWC_OrderThe 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.

ParameterTypeDescription
$orderWC_Order|nullThe order, if already found
$numberstringThe 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.

KeyDescription
menu_parentThe parent menu slug
menu_positionThe position in that menu
settings_urlWhere 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.

ParameterTypeDescription
$dirstringAbsolute path with a trailing slash