{"id":613,"date":"2023-12-11T12:44:48","date_gmt":"2023-12-11T12:44:48","guid":{"rendered":"https:\/\/help.kybernaut.cz\/help\/filters-and-actions-for-developers\/"},"modified":"2023-12-11T12:44:49","modified_gmt":"2023-12-11T12:44:49","slug":"filters-and-actions-for-developers","status":"publish","type":"ht_kb","link":"https:\/\/help.kybernaut.cz\/en\/help\/filters-and-actions-for-developers\/","title":{"rendered":"Filters and actions for developers"},"content":{"rendered":"\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">If you don&#8217;t find the filter or action you need here, <a href=\"https:\/\/help.kybernaut.cz\/potrebuji-pomoci\/\" data-type=\"page\" data-id=\"20\">please contact<\/a> me with where and how you would like it added and I will be happy to do so to make further plugin updates safe.<\/p>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_cod_methods<\/h2>\n\n\n\n<p>The filter returns slugs of payment methods that are considered cash on delivery.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_cod_methods', &#91;'cod', 'dobirka']);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$methods<\/strong> (array) Slugy payment methods considered cash on delivery.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>The filter is located in the<em> classes\/WooCommerce\/Order.php<\/em> file.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_max_package_weight<\/h2>\n\n\n\n<p>Adjusting the maximum weight of individual packages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_max_package_weight', $weight, $order);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$weight<\/strong> (int) Maximum package weight in kilograms.<\/li>\n\n\n\n<li><strong>$order<\/strong> (WC_Order) Order.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>  The filter is located in the<em> classes\/WooCommerce\/Order.php<\/em> file.  <\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_order_data<\/h2>\n\n\n\n<p>The filter returns individual parameters sent to Messenger and allows developers to edit them.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_order_data', $data, $order);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$data <\/strong>(array) Individual parameters sent to Messenger. For more information, see the <a href=\"https:\/\/portal.messenger.cz\/dev\/api\/importer#tech-spec-nepovinne-parametry\" target=\"_blank\" rel=\"noreferrer noopener\">Messenger API<\/a> documentation.<\/li>\n\n\n\n<li><strong>$order<\/strong> (WC_Order) Order.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>  The filter is located in the<em> classes\/WooCommerce\/Order.php<\/em> file.  <\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_order_to_messenger_failure<\/h2>\n\n\n\n<p>Action when an order is not successfully sent to the Messenger system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>do_action('kbnt_messenger_order_to_messenger_failure', $order, $imported);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$order<\/strong> (WC_Order) Order.<\/li>\n\n\n\n<li><strong>$imported<\/strong> (stdClass) Response from Messenger regarding the order you sent.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>  The action is located in the<em> inc\/order-to-messenger.php<\/em> file.  <\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_order_to_messenger_success<\/h2>\n\n\n\n<p>Action on successful submission of an order to the Messenger system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>do_action('kbnt_messenger_order_to_messenger_success', $order, $imported);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$order<\/strong> (WC_Order) Order.<\/li>\n\n\n\n<li><strong>$imported<\/strong> (stdClass) Response from Messenger regarding the order you sent.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>  The action is located in the<em> inc\/order-to-messenger.php<\/em> file.  <\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_package_weight<\/h2>\n\n\n\n<p>Adjustment of the weight of the packaging material.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_package_weight', $weight, $order);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$weight<\/strong> (float) Weight of packaging material.<\/li>\n\n\n\n<li><strong>$order<\/strong> (WC_Order) Order.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>  The filter is located in the<em> classes\/WooCommerce\/Order.php<\/em> file.  <\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_pcs_per_package<\/h2>\n\n\n\n<p>Adjustment of the number of products packed in each pack.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_pcs_per_package', $pcs, $order);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$pcs<\/strong> (int) Number of products in one package.<\/li>\n\n\n\n<li><strong>$order<\/strong> (WC_Order) Order.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>  The filter is located in the<em> classes\/WooCommerce\/Order.php<\/em> file.  <\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_send_error_notifications_active<\/h2>\n\n\n\n<p>Disable notifications of failed uploads to Messenger.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_send_error_notifications_active', $send_notification);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$send_notification<\/strong> (bool) Should a notification email be sent?<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>The filter is located in the<em> classes\\Logger\\Logger.php<\/em> file.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_send_error_notifications_to<\/h2>\n\n\n\n<p>Change the recipient of the notification email (default: site admin).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_send_error_notifications_to', $to);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$to <\/strong>(array) E-mail addresses of recipients.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>The filter is located in the<em> classes\\Logger\\Logger.php<\/em> file.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_send_other_shipping_methods<\/h2>\n\n\n\n<p>Option to pass <code>ID doru\u010dovac\u00edch metod<\/code> fields (e.g. <em>flat_rate<\/em>) or <code>{ID doru\u010dovac\u00ed metody}:{Instance ID doru\u010dovac\u00ed metody}<\/code> strings (e.g. <em>flat_rate:1<\/em>), where orders will also be sent to Messenger.<\/p>\n\n\n\n<p>If you don&#8217;t know the ID, you can find it in Checkout by looking at the code, as <a href=\"https:\/\/www.loom.com\/share\/59a6915de55442a89f105f4d6337fca5?sid=0bf1b05c-c565-415f-ae19-9c63e47587c8\" target=\"_blank\" rel=\"noreferrer noopener\">I show in the video tutorial<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_send_other_shipping_methods', $other_methods);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter('kbnt_messenger_send_other_shipping_methods', function() {\n  return &#91;'free_shipping', 'flat_rate:2'];\n});<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$other_methods <\/strong>(array) <code>ID doru\u010dovac\u00edch metod<\/code> (e.g. <em>flat_rate<\/em>) or strings <code>{ID doru\u010dovac\u00ed metody}:{Instance ID doru\u010dovac\u00ed metody}<\/code> (e.g. <em>flat_rate:1<\/em>), where orders will also be sent to Messenger.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>The filter is located in the<em> inc\/order-to-messenger.php<\/em> file.<br\/>Available from version 2.1.0.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_trackingstates<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>do_action('kbnt_messenger_trackingstates', $order, $data);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$order<\/strong> (WC_Order) Order.<\/li>\n\n\n\n<li><strong>$data<\/strong> (array) Data for the shipment from <a href=\"https:\/\/portal.messenger.cz\/dev\/api\/trackingstates#successful-result\">Messenger<\/a>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>The action is located in the file<em> inc\\endpoints.php<\/em>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n<\/div><\/div>\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading\">kbnt_messenger_variable_symbol_cod<\/h2>\n\n\n\n<p>Change the variable symbol for cash on delivery.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apply_filters('kbnt_messenger_variable_symbol_cod', $order_id, $order);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>$order_id <\/strong>(int) Order number.<\/li>\n\n\n\n<li><strong>$order<\/strong> (WC_Order) Order.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Source code<\/h3>\n\n\n\n<p>The filter is located in the<em> inc\\order-to-messenger.php<\/em> file.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity is-style-wide\"\/>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Does your developer need to interfere with my plugin? Here you will find a few standardized points on how to do it. <\/p>\n","protected":false},"author":1,"template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[53],"ht-kb-tag":[70],"class_list":["post-613","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-messenger-en","ht_kb_tag-snippet-en"],"_links":{"self":[{"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb\/613","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb\/613\/revisions"}],"predecessor-version":[{"id":614,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb\/613\/revisions\/614"}],"wp:attachment":[{"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/media?parent=613"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb-category?post=613"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/help.kybernaut.cz\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}