| @@ -94,8 +94,30 @@ | ||
| 94 | 94 | },1, 2); |
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | + // Default setup of NGINX Helper purges on comment insertion, which includes order notes. | |
| 99 | + // We'll remove this action in the very last filter before wp_insert_comment is called, | |
| 100 | + // when still adding order notes. IOK 2026-08-25 | |
| 101 | + if (class_exists('FastCGI_Purger')) { | |
| 102 | + add_filter('woocommerce_new_order_note_data', function ($data) { | |
| 103 | + global $wp_filter; | |
| 104 | + if (empty($wp_filter['wp_insert_comment'])) return $data; | |
| 105 | + $callbacks = $wp_filter['wp_insert_comment']->callbacks[200] ?? []; | |
| 106 | + $f = null; | |
| 107 | + foreach($callbacks as $callback) { | |
| 108 | + $fun = $callback['function']; | |
| 109 | + if (is_array($fun) && isset( $fun[0], $fun[1]) && $fun[1] == 'purge_post_on_comment') { | |
| 110 | + $f = $fun; break; | |
| 111 | + } | |
| 112 | + } | |
| 113 | + if ($f) { | |
| 114 | + remove_action('wp_insert_comment', $f, 200); | |
| 115 | + } | |
| 116 | + return $data; | |
| 117 | + }); | |
| 118 | + } | |
| 119 | + | |
| 98 | 120 | }, 20); |
| 99 | 121 | |
| 100 | 122 | // IOK 2020-03-17: Klarna Checkout now supports external payment methods, such as Vipps. This is great, but we need first to check |
| 101 | 123 | // that any user hasn't already installed the free plugin for this created by Krokedil. If they have, this filter will be present: |
| @@ -177,11 +199,11 @@ | ||
| 177 | 199 | add_action('woocommerce_new_order_item', 'woo_vipps_remove_no_ajax' , 11); |
| 178 | 200 | }); |
| 179 | 201 | } |
| 180 | 202 | |
| 181 | - // Support Woo-Mailerlite in Vipps Checkout | |
| 203 | + // Support Woo-Mailerlite in Checkout | |
| 182 | 204 | if (class_exists('MailerLite\Includes\Classes\Settings\MailerLiteSettings')) { |
| 183 | - // If Mailerlite is active as well as Vipps Checkout, then add support for it | |
| 205 | + // If Mailerlite is active as well as Checkout, then add support for it | |
| 184 | 206 | if (get_option('ml_account_authenticated') && (Vipps::instance()->gateway()->get_option('vipps_checkout_enabled') == 'yes')) { |
| 185 | 207 | |
| 186 | 208 | // If checkout is active, don't support saving "lost carts" |
| 187 | 209 | add_filter('option_mailerlite_disable_checkout_sync', function ($value, $option) { |
| @@ -187,9 +209,9 @@ | ||
| 187 | 209 | add_filter('option_mailerlite_disable_checkout_sync', function ($value, $option) { |
| 188 | 210 | return 1; |
| 189 | 211 | }, 10, 2); |
| 190 | 212 | |
| 191 | - // Check if the checkout feature is enabled for MailerLite, and if so, add the feature for Vipps Checkout | |
| 213 | + // Check if the checkout feature is enabled for MailerLite, and if so, add the feature for Checkout | |
| 192 | 214 | $checkout = MailerLite\Includes\Classes\Settings\MailerLiteSettings::getInstance()->getMlOption('checkout', 'no'); |
| 193 | 215 | if ($checkout == 'yes') { |
| 194 | 216 | add_filter('woo_vipps_checkout_consent_query', function ($text) { |
| 195 | 217 | return MailerLite\Includes\Classes\Settings\MailerLiteSettings::getInstance()->getMlOption('checkout_label'); |
| @@ -214,9 +236,9 @@ | ||
| 214 | 236 | } |
| 215 | 237 | } |
| 216 | 238 | } |
| 217 | 239 | |
| 218 | - // Support Mailchimp for WooCommerce in Vipps Checkout | |
| 240 | + // Support Mailchimp for WooCommerce in Checkout | |
| 219 | 241 | if (function_exists('mailchimp_is_configured') && class_exists('MailChimp_Service')) { |
| 220 | 242 | // If mailchimp is configured and Checkout is on, add actions |
| 221 | 243 | if (mailchimp_is_configured() && (Vipps::instance()->gateway()->get_option('vipps_checkout_enabled') == 'yes')) { |
| 222 | 244 | |