PluginProbe
Route ‑ Shipping Protection / 2.4.19
Route ‑ Shipping Protection v2.4.19
2.4.19 2.4.18 2.4.17 2.4.16 2.4.15 2.4.14 2.4.13 2.4.12 2.4.11 2.4.10 2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.2.4 2.2.5 2.2.6 2.2.8 2.2.9 2.3.0 2.3.1 All 153 releases
← All changes | admin/class-routeapp-webhooks.php +36 -0 2.4.18 → 2.4.19 View file →
@@ -394,8 +394,44 @@
394 394 return false;
395 395 }
396 396
397 397 /**
398 + * Merchant opted out of plugin order posting.
399 + *
400 + * True only when every RouteApp Order Upsert webhook is paused. Missing
401 + * webhooks, and Active or Disabled ones, still reconcile: Disabled is
402 + * WooCommerce's automatic status after delivery failures.
403 + *
404 + * @return bool
405 + */
406 + public static function is_order_upsert_paused() {
407 + if (!class_exists('WC_Data_Store')) {
408 + return false;
409 + }
410 + $data_store = \WC_Data_Store::load('webhook');
411 + $ids = $data_store->search_webhooks(array('limit' => -1));
412 + if (!is_array($ids) || empty($ids)) {
413 + return false;
414 + }
415 +
416 + $found = false;
417 + foreach ($ids as $id) {
418 + $webhook = function_exists('wc_get_webhook') ? wc_get_webhook($id) : false;
419 + if (!self::is_webhook_like($webhook, true)) {
420 + continue;
421 + }
422 + if ('RouteApp Order Upsert' !== $webhook->get_name()) {
423 + continue;
424 + }
425 + $found = true;
426 + if ('paused' !== $webhook->get_status()) {
427 + return false;
428 + }
429 + }
430 + return $found;
431 + }
432 +
433 + /**
398 434 * Update in place. Do not delete+recreate (that is what duplicated hooks).
399 435 *
400 436 * @param object $webhook WC_Webhook.
401 437 * @param array $values Expected webhook config.