From 6553de469b8f9671a1e6aa24f28ccf1e3205e263 Mon Sep 17 00:00:00 2001 From: Paul Sealock Date: Wed, 4 May 2022 14:09:21 +1200 Subject: [PATCH] Test Failures: Check WP version 5.9 before adding mini_cart_block to WC Tracker (#32862) --- .../woocommerce/changelog/fix-mini_cart_block-tests-failing | 4 ++++ plugins/woocommerce/includes/class-wc-tracker.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 plugins/woocommerce/changelog/fix-mini_cart_block-tests-failing diff --git a/plugins/woocommerce/changelog/fix-mini_cart_block-tests-failing b/plugins/woocommerce/changelog/fix-mini_cart_block-tests-failing new file mode 100644 index 00000000000..24d8e4b9d0d --- /dev/null +++ b/plugins/woocommerce/changelog/fix-mini_cart_block-tests-failing @@ -0,0 +1,4 @@ +Significance: minor +Type: dev + +Check WP version 5.9 before adding mini_cart_block to WC Tracker diff --git a/plugins/woocommerce/includes/class-wc-tracker.php b/plugins/woocommerce/includes/class-wc-tracker.php index 20371efd7d4..eb94cc10b93 100644 --- a/plugins/woocommerce/includes/class-wc-tracker.php +++ b/plugins/woocommerce/includes/class-wc-tracker.php @@ -167,8 +167,10 @@ class WC_Tracker { // Cart & checkout tech (blocks or shortcodes). $data['cart_checkout'] = self::get_cart_checkout_info(); - // Mini Cart block. - $data['mini_cart_block'] = self::get_mini_cart_info(); + // Mini Cart block, which only exists since wp 5.9. + if ( version_compare( get_bloginfo( 'version' ), '5.9', '>=' ) ) { + $data['mini_cart_block'] = self::get_mini_cart_info(); + } // WooCommerce Admin info. $data['wc_admin_disabled'] = apply_filters( 'woocommerce_admin_disabled', false ) ? 'yes' : 'no';