From 49715f52247b53b188be51e237de296d8d8006ba Mon Sep 17 00:00:00 2001 From: Juanma Rodriguez Escriche Date: Thu, 12 Sep 2024 13:19:35 +0200 Subject: [PATCH] Sync Checksums: Ensure is plugin active exists (#39369) * Ensure is_plugin_active exists --- .../changelog/update-sync-ensure-is-plugin-active-exists | 4 ++++ .../sync/src/modules/class-woocommerce-hpos-orders.php | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 projects/packages/sync/changelog/update-sync-ensure-is-plugin-active-exists diff --git a/projects/packages/sync/changelog/update-sync-ensure-is-plugin-active-exists b/projects/packages/sync/changelog/update-sync-ensure-is-plugin-active-exists new file mode 100644 index 0000000000000..3732f745ae4a4 --- /dev/null +++ b/projects/packages/sync/changelog/update-sync-ensure-is-plugin-active-exists @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Sync: Ensure is_plugin_active exists when loading Table Checksums diff --git a/projects/packages/sync/src/modules/class-woocommerce-hpos-orders.php b/projects/packages/sync/src/modules/class-woocommerce-hpos-orders.php index f4630946caa29..d8b3f943acd36 100644 --- a/projects/packages/sync/src/modules/class-woocommerce-hpos-orders.php +++ b/projects/packages/sync/src/modules/class-woocommerce-hpos-orders.php @@ -85,6 +85,11 @@ public function __construct() { public static function get_order_types_to_sync( $prefixed = false ) { $types = array( 'order', 'order_refund' ); + // Ensure this is available. + if ( ! function_exists( 'is_plugin_active' ) ) { + require_once ABSPATH . 'wp-admin/includes/plugin.php'; + } + if ( is_plugin_active( self::WOOCOMMERCE_SUBSCRIPTIONS_PATH ) ) { $types[] = 'subscription'; }