1. Home
  2. Messenger
  3. Filters and actions for developers

Filters and actions 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_messenger_cod_methods

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

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

Parameters

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

Source code

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


kbnt_messenger_max_package_weight

Adjusting the maximum weight of individual packages.

apply_filters('kbnt_messenger_max_package_weight', $weight, $order);

Parameters

  • $weight (int) Maximum package weight in kilograms.
  • $order (WC_Order) Order.

Source code

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


kbnt_messenger_order_data

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

apply_filters('kbnt_messenger_order_data', $data, $order);

Parameters

  • $data (array) Individual parameters sent to Messenger. For more information, see the Messenger API documentation.
  • $order (WC_Order) Order.

Source code

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


kbnt_messenger_order_to_messenger_failure

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

do_action('kbnt_messenger_order_to_messenger_failure', $order, $imported);

Parameters

  • $order (WC_Order) Order.
  • $imported (stdClass) Response from Messenger regarding the order you sent.

Source code

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


kbnt_messenger_order_to_messenger_success

Action on successful submission of an order to the Messenger system.

do_action('kbnt_messenger_order_to_messenger_success', $order, $imported);

Parameters

  • $order (WC_Order) Order.
  • $imported (stdClass) Response from Messenger regarding the order you sent.

Source code

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


kbnt_messenger_package_weight

Adjustment of the weight of the packaging material.

apply_filters('kbnt_messenger_package_weight', $weight, $order);

Parameters

  • $weight (float) Weight of packaging material.
  • $order (WC_Order) Order.

Source code

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


kbnt_messenger_pcs_per_package

Adjustment of the number of products packed in each pack.

apply_filters('kbnt_messenger_pcs_per_package', $pcs, $order);

Parameters

  • $pcs (int) Number of products in one package.
  • $order (WC_Order) Order.

Source code

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


kbnt_messenger_send_error_notifications_active

Disable notifications of failed uploads to Messenger.

apply_filters('kbnt_messenger_send_error_notifications_active', $send_notification);

Parameters

  • $send_notification (bool) Should a notification email be sent?

Source code

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


kbnt_messenger_send_error_notifications_to

Change the recipient of the notification email (default: site admin).

apply_filters('kbnt_messenger_send_error_notifications_to', $to);

Parameters

  • $to (array) E-mail addresses of recipients.

Source code

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


kbnt_messenger_send_other_shipping_methods

Option to pass ID doručovacích metod fields (e.g. flat_rate) or {ID doručovací metody}:{Instance ID doručovací metody} strings (e.g. flat_rate:1), where orders will also be sent to Messenger.

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

apply_filters('kbnt_messenger_send_other_shipping_methods', $other_methods);

Example

add_filter('kbnt_messenger_send_other_shipping_methods', function() {
  return ['free_shipping', 'flat_rate:2'];
});

Parameters

  • $other_methods (array) ID doručovacích metod (e.g. flat_rate) or strings {ID doručovací metody}:{Instance ID doručovací metody} (e.g. flat_rate:1), where orders will also be sent to Messenger.

Source code

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


kbnt_messenger_trackingstates

do_action('kbnt_messenger_trackingstates', $order, $data);

Parameters

  • $order (WC_Order) Order.
  • $data (array) Data for the shipment from Messenger.

Source code

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


kbnt_messenger_variable_symbol_cod

Change the variable symbol for cash on delivery.

apply_filters('kbnt_messenger_variable_symbol_cod', $order_id, $order);

Parameters

  • $order_id (int) Order number.
  • $order (WC_Order) Order.

Source code

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


Updated on December 11, 2023

Was this article helpful?

Related Articles