Skip to content
Čeština

Developer filters and actions

If you can’t find a filter or action you need here, contact me with where and how you’d like it added, and I’ll be glad to do so, so that future plugin updates stay safe.

The filter returns the slugs of payment methods that are treated as cash on delivery.

apply_filters('kbnt_messenger_cod_methods', ['cod', 'dobirka']);
  • $methods (array) Slugs of the payment methods treated as cash on delivery.

The filter is located in the file classes/WooCommerce/Order.php.


Adjusts the maximum weight of an individual package.

apply_filters('kbnt_messenger_max_package_weight', $weight, $order);
  • $weight (int) The maximum package weight in kilograms.
  • $order (WC_Order) The order.

The filter is located in the file classes/WooCommerce/Order.php.


The filter returns the individual parameters sent to Messenger and lets developers modify them.

apply_filters('kbnt_messenger_order_data', $data, $order);
  • $data (array) The individual parameters sent to Messenger. More information in the Messenger API documentation.
  • $order (WC_Order) The order.

The filter is located in the file classes/WooCommerce/Order.php.


Action fired when an order fails to be sent to the Messenger system.

do_action('kbnt_messenger_order_to_messenger_failure', $order, $imported);
  • $order (WC_Order) The order.
  • $imported (stdClass) Messenger’s response regarding the sent order.

The action is located in the file inc/order-to-messenger.php.


Action fired when an order is successfully sent to the Messenger system.

do_action('kbnt_messenger_order_to_messenger_success', $order, $imported);
  • $order (WC_Order) The order.
  • $imported (stdClass) Messenger’s response regarding the sent order.

The action is located in the file inc/order-to-messenger.php.


Adjusts the weight of the packaging material.

apply_filters('kbnt_messenger_package_weight', $weight, $order);
  • $weight (float) The weight of the packaging material.
  • $order (WC_Order) The order.

The filter is located in the file classes/WooCommerce/Order.php.


Adjusts the number of products packed in each package.

apply_filters('kbnt_messenger_pcs_per_package', $pcs, $order);
  • $pcs (int) The number of products in a single package.
  • $order (WC_Order) The order.

The filter is located in the file classes/WooCommerce/Order.php.


kbnt_messenger_send_error_notifications_active

Section titled “kbnt_messenger_send_error_notifications_active”

Disables notifications about failed sends to Messenger.

apply_filters('kbnt_messenger_send_error_notifications_active', $send_notification);
  • $send_notification (bool) Should the notification e-mail be sent?

The filter is located in the file classes\Logger\Logger.php.


kbnt_messenger_send_error_notifications_to

Section titled “kbnt_messenger_send_error_notifications_to”

Changes the recipient of the notification e-mail (default: the site admin).

apply_filters('kbnt_messenger_send_error_notifications_to', $to);
  • $to (array) The recipients’ e-mail addresses.

The filter is located in the file classes\Logger\Logger.php.


kbnt_messenger_send_other_shipping_methods

Section titled “kbnt_messenger_send_other_shipping_methods”

Lets you pass an array of shipping method IDs (e.g. flat_rate) or strings {shipping method ID}:{shipping method instance ID} (e.g. flat_rate:1) for which orders will also be sent to Messenger.

If you don’t know the ID, you can find it on the Checkout by looking at the code, as I show in the video tutorial.

apply_filters('kbnt_messenger_send_other_shipping_methods', $other_methods);
add_filter('kbnt_messenger_send_other_shipping_methods', function() {
return ['free_shipping', 'flat_rate:2'];
});
  • $other_methods (array) shipping method IDs (e.g. flat_rate) or strings {shipping method ID}:{shipping method instance ID} (e.g. flat_rate:1) for which orders will also be sent to Messenger.

The filter is located in the file inc/order-to-messenger.php.
Available since version 2.1.0.


do_action('kbnt_messenger_trackingstates', $order, $data);
  • $order (WC_Order) The order.
  • $data (array) Shipment data from Messenger.

The action is located in the file inc\endpoints.php.


kbnt_messenger_trackingstates_order_not_found

Section titled “kbnt_messenger_trackingstates_order_not_found”
do_action('kbnt_messenger_trackingstates', $data);
  • $data (array) Shipment data from Messenger.

The action is located in the file inc\endpoints.php.


Changes the variable symbol for cash-on-delivery payment.

apply_filters('kbnt_messenger_variable_symbol_cod', $order_id, $order);
  • $order_id (int) The order number.
  • $order (WC_Order) The order.

The filter is located in the file inc\order-to-messenger.php.


Was this page helpful?