1. Home
  2. Mailstep
  3. Filters for developers

Filters for developers

If you don’t find the filter or action you need here, please contact me with where and how you would like it added and I will be happy to do so to make further plugin updates safe.

kbnt_mailstep_blocked_statuses_update

The filter returns order statuses where the order status is no longer updated based on Mailstep data.

apply_filters('kbnt_mailstep_blocked_statuses_update', ['completed',
 'failed', 'cancelled', 'refunded']);

Parameters

  • $statuses (array) Order states

Source code

The filter is located in the file includes/class-kbnt-mailstep-orders.php.

kbnt_mailstep_cod_payment_methods

The filter returns slugs of payment methods that are considered cash on delivery.

apply_filters('kbnt_mailstep_cod_payment_methods', ['cod', 'dobirka']);

Parameters

  • $methods (array) Slugy payment methods considered cash on delivery.

Source code

The filter is located in the files includes/class-kbnt-mailstep-api.php, includes/class-kbnt-mailstep-orders.php.

kbnt_mailstep_fallback_couriers

Allows you to introduce a fallback for unset couriers. Accepts the WooCommerce shipping method ID fas a key and the Mailstep courier ID as a value.

apply_filters('kbnt_mailstep_fallback_couriers', []);

Parameters

  • $fallback_couriers (array) WC method_id → Mailstep courier_id.

Example of use

add_filter('kbnt_mailstep_fallback_couriers', function(){
	return [
		"local_pickup" => 123,
	];
});

Source code

The filter is located in the file includes/class-kbnt-mailstep-api.php.

kbnt_mailstep_get_order_courier_id

Allows you to edit the Courier ID.

apply_filters('kbnt_mailstep_get_order_courier_id', get_option('wc_kbnt_mailstep_settings_shipping_' . $shipping_method->get_method_id() . ':' . $shipping_method->get_instance_id(), false), $order, $shipping_method->get_method_id(), $shipping_method->get_instance_id());

Parameters

  • $courier_id (int) Courier ID (according to Cybernaut Mailstep settings).
  • $order (WC_Order) Order.
  • $method_id (string) Delivery method ID.
  • $instance_id (string) The instance ID of the delivery method.

Source code

The filter is located in the file includes/class-kbnt-mailstep-api.php.


kbnt_mailstep_order_set

The filter returns the individual parameters sent to Mailstep and allows developers to edit them.

apply_filters('kbnt_mailstep_order_set', $parameters, $order);

Parameters

  • $parameters (array) Individual parameters sent to Mailstep.
  • $order (WC_Order) Order.

Source code

The filter is located in the file includes/class-kbnt-mailstep-api.php.


kbnt_mailstep_sync_excluded_store_ids

The filter allows you to exclude warehouses from Mailstep’s warehouse status synchronization. Store IDs can be found either from Mailstep or in the log. Empty the sync cache after changing the edit.

apply_filters('kbnt_mailstep_sync_excluded_store_ids', []);

Parameters

  • $exluded_store_ids (array) List of stack IDs (string).

Source code

The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.


kbnt_mailstep_sync_inventory_products_per_sync

The filter returns the individual how many products are synchronized with the stock status in Mailstep at once.

apply_filters('kbnt_mailstep_sync_inventory_products_per_sync', 300);

Parameters

  • $products_per_sync (int) Number of products synchronized at once.

Source code

The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.


kbnt_mailstep_sync_inventory_recurrence

The filter allows you to set how often the automatic synchronization of the warehouse will be triggered. After the change, turn the warehouse synchronization off and on to allow rescheduling to occur.

apply_filters('kbnt_mailstep_sync_inventory_recurrence', 'hourly');

Parameters

  • $recurrence (string) How often the event should subsequently be repeated. For acceptable values, see wp_get_schedules().

Source code

The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.


kbnt_mailstep_sync_only_store_id

The filter allows you to select one warehouse to be selected for synchronizing the warehouse status from Mailstep. You can find out the Store ID either from Mailstep or in the log. Empty the synchronization cache after changing the edit.

apply_filters('kbnt_mailstep_sync_only_store_id', "")

Parameters

  • $store_id (string) Warehouse ID.

Source code

The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.


kbnt_mailstep_unreleased_stock_order_statuses

This setting will allow working with a “blocked” warehouse, i.e. adds the goods not stocked by Mailstep to the stock on the e-shop and thus prevents artificially increasing the stock. By default it contains “Pending”, “On hold” and “Mailstep – incorrectly entered”, but you can modify them as follows. After the modification , you need to empty the storage cache.

apply_filters('kbnt_mailstep_unreleased_stock_order_statuses', ['wc-pending', 'wc-inputerror', 'wc-on-hold']);

Parameters

  • $statuses (array) Order states

Source code

The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.


kbnt_mailstep_skip_order_item

Allows you to skip an order item (product) so it is not sent to Mailstep. Return true to skip the given item. It is used, for example, by the WooCommerce Product Bundles integration to omit the bundle parent product.

apply_filters('kbnt_mailstep_skip_order_item', false, $product);

Parameters

  • $skip (bool) Whether to skip the item (default false).
  • $product (WC_Product) The order item product.

Source code

The filter is located in the file includes/class-kbnt-mailstep-api.php.


kbnt_mailstep_api_timeout

Sets the timeout (in seconds) for requests to the Mailstep API.

apply_filters('kbnt_mailstep_api_timeout', 90);

Parameters

  • $timeout (int) Timeout in seconds (default 90).

Source code

The filter is located in the file includes/class-kbnt-mailstep-api.php.


kbnt_mailstep_get_order_id_from_order_number

Allows you to change how a WooCommerce order ID is resolved from a Mailstep order number – useful when you use custom order numbering.

apply_filters('kbnt_mailstep_get_order_id_from_order_number', $order_id, $order_number);

Parameters

  • $order_id (int|false) The resolved order ID.
  • $order_number (string) The order number from Mailstep.

Source code

The filter is located in the file includes/admin/wc-tools.php.


kbnt_mailstep_status_lookback_days

Determines how many days back the status polling searches when fetching order statuses from Mailstep (Mailstep can only filter by date). The default is 30 days; the “Mailstep – force update order status” action is hidden for older orders.

apply_filters('kbnt_mailstep_status_lookback_days', 30);

Parameters

  • $days (int) Number of days to look back (default 30).

Source code

The filter is located in the file kybernaut-mailstep.php.


kbnt_mailstep_allowed_product_statuses

Returns the product statuses included in product queries (e.g. during stock synchronization).

apply_filters('kbnt_mailstep_allowed_product_statuses', ['publish', 'draft', 'private']);

Parameters

  • $statuses (array) Product statuses (default publish, draft, private).

Source code

The filter is located in the file includes/class-kbnt-mailstep-products.php.


kbnt_mailstep_order_failed_to_send_notification_recipient

Returns the recipients of the admin e-mail notification sent when an order fails to be sent to Mailstep.

apply_filters('kbnt_mailstep_order_failed_to_send_notification_recipient', [get_option('admin_email')]);

Parameters

  • $recipients (array) An array of e-mail addresses (default the administrator e-mail).

Source code

The filter is located in the file includes/add-order-status.php.


kbnt_mailstep_order_statuses_pairs

Returns the mapping of Mailstep numeric statuses (0–14) to WooCommerce order status slugs.

apply_filters('kbnt_mailstep_order_statuses_pairs', $statuses);

Parameters

  • $statuses (array) An array of Mailstep ID → WooCommerce status slug.

Example of use

add_filter('kbnt_mailstep_order_statuses_pairs', function ($statuses) {
	$keep_statuses = ['cancelled', 'refunded', 'completed', 'inputerror'];
	foreach ($statuses as $key => $value) {
		if (!in_array($value, $keep_statuses)) {
			unset($statuses[$key]);
		}
	}
	$statuses[4] = 'completed';
	return $statuses;
});

Source code

The filter is located in the file kybernaut-mailstep.php.


Actions for developers

Actions (hooks) – the following points let you attach your own code via add_action() to the plugin’s events.


kbnt_mailstep_status_get_process_order_by_order

Fires for each order while polling statuses from Mailstep and is the main extension point for processing an order status. By default it has the status mapping, the “On the way” intermediate-status handling and the order-cancellation blocking hooked to it (priorities 10/20/30).

do_action('kbnt_mailstep_status_get_process_order_by_order', $order, $mailstep_status);

Parameters

  • $order (WC_Order) The order.
  • $mailstep_status (stdClass) The status object from Mailstep.

Example of use

add_action('kbnt_mailstep_status_get_process_order_by_order', function ($order, $mailstep_status) {
	if ((int) $mailstep_status->status_id === 10) {
		$order->add_order_note('Mailstep status 10 received.');
	}
}, 40, 2);

Source code

The action is located in the file kybernaut-mailstep.php.


kbnt_mailstep_add_tracking_id

Fires with the shipment tracking number (tracking ID) obtained from Mailstep so you can work with it further – e.g. store it on the order.

do_action('kbnt_mailstep_add_tracking_id', $tracking_id, $order);

Parameters

  • $tracking_id (string) The shipment tracking number from Mailstep.
  • $order (WC_Order) The order.

Example of use

add_action('kbnt_mailstep_add_tracking_id', function ($tracking_id, $order) {
	if (class_exists('WC_Shipment_Tracking_Api')) {
		WC_Shipment_Tracking_Api::add_tracking_number($order->get_id(), $tracking_id, 'mailstep', current_time('mysql'), '');
	}
}, 100, 2);

Source code

The action is located in the file includes/class-kbnt-mailstep-orders.php.


kbnt_mailstep_inventory_sync_update_product_stock

Fires for each product during stock synchronization from Mailstep (after a stock change is detected).

do_action('kbnt_mailstep_inventory_sync_update_product_stock', $product, $new_stock, $parent_id);

Parameters

  • $product (WC_Product) The product (or variation).
  • $new_stock (int) The new stock level.
  • $parent_id (int|false) The parent product ID for variations, otherwise false.

Example of use

add_action('kbnt_mailstep_inventory_sync_update_product_stock', function ($product, $new_stock, $parent_id) {
	// Custom handling after a product stock update.
}, 10, 3);

Source code

The action is located in the file includes/class-kbnt-mailstep-inventory-sync.php.


kbnt_mailstep_order_failed_to_send

Fires when an order fails to be sent to Mailstep (e.g. an API error or no response).

do_action('kbnt_mailstep_order_failed_to_send', $order, $error_message);

Parameters

  • $order (WC_Order) The order.
  • $error_message (string) The error description.

Source code

The action is located in the file includes/class-kbnt-mailstep-api.php.

Updated on June 29, 2026

Was this article helpful?

Related Articles