Developer filters
If you can’t find a filter or action here that you need, contact me with where and how you’d like it added, and I’ll gladly do so, to keep future plugin updates safe.
kbnt_mailstep_blocked_statuses_update
Section titled “kbnt_mailstep_blocked_statuses_update”The filter returns the order statuses for which the order status is no longer updated based on data from Mailstep.
apply_filters('kbnt_mailstep_blocked_statuses_update', ['completed', 'failed', 'cancelled', 'refunded']);Parameters
Section titled “Parameters”- $statuses (array) Order statuses
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-orders.php.
kbnt_mailstep_cod_payment_methods
Section titled “kbnt_mailstep_cod_payment_methods”The filter returns the slugs of payment methods that are considered cash on delivery.
apply_filters('kbnt_mailstep_cod_payment_methods', ['cod', 'dobirka']);Parameters
Section titled “Parameters”- $methods (array) Slugs of payment methods considered cash on delivery.
Source code
Section titled “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
Section titled “kbnt_mailstep_fallback_couriers”Lets you introduce a fallback for couriers that aren’t set. It accepts an array with the WooCommerce delivery method ID as the key and the Mailstep Courier ID as the value.
apply_filters('kbnt_mailstep_fallback_couriers', []);Parameters
Section titled “Parameters”- $fallback_couriers (array) WC method_id → Mailstep courier_id.
Example usage
Section titled “Example usage”add_filter('kbnt_mailstep_fallback_couriers', function(){ return [ "local_pickup" => 123, ];});Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-api.php.
kbnt_mailstep_get_order_courier_id
Section titled “kbnt_mailstep_get_order_courier_id”Lets you modify 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
Section titled “Parameters”- $courier_id (int) Courier ID (according to the Kybernaut Mailstep settings).
- $order (WC_Order) The order.
- $method_id (string) The delivery method ID.
- $instance_id (string) The delivery method instance ID.
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-api.php.
kbnt_mailstep_order_set
Section titled “kbnt_mailstep_order_set”The filter returns the individual parameters sent to Mailstep and lets developers modify them.
apply_filters('kbnt_mailstep_order_set', $parameters, $order);Parameters
Section titled “Parameters”- $parameters (array) The individual parameters sent to Mailstep.
- $order (WC_Order) The order.
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-api.php.
kbnt_mailstep_sync_excluded_store_ids
Section titled “kbnt_mailstep_sync_excluded_store_ids”The filter lets you exclude warehouses from the Mailstep stock status synchronization. You can find the Store IDs either from Mailstep or in the log. After a change, clear the synchronization cache.
apply_filters('kbnt_mailstep_sync_excluded_store_ids', []);Parameters
Section titled “Parameters”- $exluded_store_ids (array) A list of warehouse IDs (string).
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.
kbnt_mailstep_sync_inventory_products_per_sync
Section titled “kbnt_mailstep_sync_inventory_products_per_sync”The filter returns how many products are synchronized with the stock level in Mailstep at once.
apply_filters('kbnt_mailstep_sync_inventory_products_per_sync', 300);Parameters
Section titled “Parameters”- $products_per_sync (int) The number of products synchronized at once.
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.
kbnt_mailstep_sync_inventory_recurrence
Section titled “kbnt_mailstep_sync_inventory_recurrence”The filter lets you set how often the automatic stock synchronization runs. After a change, turn stock synchronization off and on again so it gets rescheduled.
apply_filters('kbnt_mailstep_sync_inventory_recurrence', 'hourly');Parameters
Section titled “Parameters”- $recurrence (string) How often the event should subsequently repeat. You can find the permitted values in the wp_get_schedules() function.
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.
kbnt_mailstep_sync_only_store_id
Section titled “kbnt_mailstep_sync_only_store_id”The filter lets you select a single warehouse to be used for the Mailstep stock status synchronization. You can find the Store ID either from Mailstep or in the log. After a change, clear the synchronization cache.
apply_filters('kbnt_mailstep_sync_only_store_id', "")Parameters
Section titled “Parameters”- $store_id (string) The warehouse ID.
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.
kbnt_mailstep_unreleased_stock_order_statuses
Section titled “kbnt_mailstep_unreleased_stock_order_statuses”This setting lets you work with “blocked” stock, i.e. it adds goods not yet released by Mailstep to the shop’s stock level and thus prevents artificially inflating the stock. By default it contains “Pending payment” (Pending), “On hold” (On hold) and “Mailstep – Input error”, but you can adjust them this way. After adjusting, you must clear the stock cache.
apply_filters('kbnt_mailstep_unreleased_stock_order_statuses', ['wc-pending', 'wc-inputerror', 'wc-on-hold']);Parameters
Section titled “Parameters”- $statuses (array) Order statuses
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-inventory-sync.php.
kbnt_mailstep_skip_order_item
Section titled “kbnt_mailstep_skip_order_item”The filter lets you skip an order item (product) so that it isn’t sent to Mailstep. Return true to skip the given item. It’s used, for example, by the WooCommerce Product Bundles integration to omit the bundle’s parent product.
apply_filters('kbnt_mailstep_skip_order_item', false, $product);Parameters
Section titled “Parameters”- $skip (bool) Whether to skip the item (default
false). - $product (WC_Product) The order item’s product.
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-api.php.
kbnt_mailstep_api_timeout
Section titled “kbnt_mailstep_api_timeout”The filter sets the time limit (in seconds) for requests to the Mailstep API.
apply_filters('kbnt_mailstep_api_timeout', 90);Parameters
Section titled “Parameters”- $timeout (int) The time limit in seconds (default
90).
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-api.php.
kbnt_mailstep_get_order_id_from_order_number
Section titled “kbnt_mailstep_get_order_id_from_order_number”The filter lets you customize how a WooCommerce order ID is looked up from an order number in Mailstep – useful with custom order numbering.
apply_filters('kbnt_mailstep_get_order_id_from_order_number', $order_id, $order_number);Parameters
Section titled “Parameters”- $order_id (int|false) The looked-up order ID.
- $order_number (string) The order number from Mailstep.
Source code
Section titled “Source code”The filter is located in the file includes/admin/wc-tools.php.
kbnt_mailstep_status_lookback_days
Section titled “kbnt_mailstep_status_lookback_days”The filter determines how many days back are searched when pulling order statuses from Mailstep (Mailstep only allows filtering by date). The default value is 30 days; the “Mailstep – force update order status” action is hidden for older orders.
apply_filters('kbnt_mailstep_status_lookback_days', 30);Parameters
Section titled “Parameters”- $days (int) The number of days back (default
30).
Source code
Section titled “Source code”The filter is located in the file kybernaut-mailstep.php.
kbnt_mailstep_allowed_product_statuses
Section titled “kbnt_mailstep_allowed_product_statuses”The filter returns the product statuses that are included in product queries (e.g. during stock synchronization).
apply_filters('kbnt_mailstep_allowed_product_statuses', ['publish', 'draft', 'private']);Parameters
Section titled “Parameters”- $statuses (array) Product statuses (default
publish,draft,private).
Source code
Section titled “Source code”The filter is located in the file includes/class-kbnt-mailstep-products.php.
kbnt_mailstep_order_failed_to_send_notification_recipient
Section titled “kbnt_mailstep_order_failed_to_send_notification_recipient”The filter returns the recipients of the admin e-mail notification that is 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
Section titled “Parameters”- $recipients (array) An array of e-mail addresses (default: the administrator’s e-mail).
Source code
Section titled “Source code”The filter is located in the file includes/add-order-status.php.
kbnt_mailstep_order_statuses_pairs
Section titled “kbnt_mailstep_order_statuses_pairs”The filter returns the mapping of numeric Mailstep statuses (0–14) to WooCommerce order status slugs.
apply_filters('kbnt_mailstep_order_statuses_pairs', $statuses);Parameters
Section titled “Parameters”- $statuses (array) An array in the form Mailstep ID → WooCommerce status slug.
Example usage
Section titled “Example usage”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
Section titled “Source code”The filter is located in the file kybernaut-mailstep.php.
Actions for developers
Section titled “Actions for developers”Actions (hooks) – the following items let you attach your own code to the plugin’s events using add_action().
kbnt_mailstep_status_get_process_order_by_order
Section titled “kbnt_mailstep_status_get_process_order_by_order”The action runs for each order when pulling statuses from Mailstep and is the main extension point for processing an order status. By default, status mapping, handling of the intermediate “On the way” status, and blocking of order cancellation are hooked onto it (priorities 10/20/30).
do_action('kbnt_mailstep_status_get_process_order_by_order', $order, $mailstep_status);Parameters
Section titled “Parameters”- $order (WC_Order) The order.
- $mailstep_status (stdClass) The status object from Mailstep.
Example usage
Section titled “Example usage”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
Section titled “Source code”The action is located in the file kybernaut-mailstep.php.
kbnt_mailstep_add_tracking_id
Section titled “kbnt_mailstep_add_tracking_id”The action runs with the shipment’s tracking number (tracking ID) obtained from Mailstep, so you can work with it further – for example, save it to the order.
do_action('kbnt_mailstep_add_tracking_id', $tracking_id, $order);Parameters
Section titled “Parameters”- $tracking_id (string) The shipment’s tracking number from Mailstep.
- $order (WC_Order) The order.
Example usage
Section titled “Example usage”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
Section titled “Source code”The action is located in the file includes/class-kbnt-mailstep-orders.php.
kbnt_mailstep_inventory_sync_update_product_stock
Section titled “kbnt_mailstep_inventory_sync_update_product_stock”The action runs 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
Section titled “Parameters”- $product (WC_Product) The product (or variation).
- $new_stock (int) The new stock level.
- $parent_id (int|false) The parent product’s ID for variations, otherwise
false.
Example usage
Section titled “Example usage”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
Section titled “Source code”The action is located in the file includes/class-kbnt-mailstep-inventory-sync.php.
kbnt_mailstep_order_failed_to_send
Section titled “kbnt_mailstep_order_failed_to_send”The action runs 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
Section titled “Parameters”- $order (WC_Order) The order.
- $error_message (string) A description of the error.
Source code
Section titled “Source code”The action is located in the file includes/class-kbnt-mailstep-api.php.
Was this page helpful?
Thanks for the feedback!
Sorry to hear that. Tell me what was missing and how I can help →