From 35cd4518bb33524c5c7209dc96f1adaf46a74858 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 9 Nov 2022 16:14:34 +0000 Subject: [PATCH] Enqueue fragments only in the cart widget --- plugins/woocommerce/includes/class-wc-frontend-scripts.php | 1 - plugins/woocommerce/includes/widgets/class-wc-widget-cart.php | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce/includes/class-wc-frontend-scripts.php b/plugins/woocommerce/includes/class-wc-frontend-scripts.php index 4ddbb076061..d95833aa819 100644 --- a/plugins/woocommerce/includes/class-wc-frontend-scripts.php +++ b/plugins/woocommerce/includes/class-wc-frontend-scripts.php @@ -430,7 +430,6 @@ class WC_Frontend_Scripts { // Global frontend scripts. self::enqueue_script( 'woocommerce' ); - self::enqueue_script( 'wc-cart-fragments' ); // CSS Styles. $enqueue_styles = self::get_styles(); diff --git a/plugins/woocommerce/includes/widgets/class-wc-widget-cart.php b/plugins/woocommerce/includes/widgets/class-wc-widget-cart.php index cc76280b5a7..0d33873c5cc 100644 --- a/plugins/woocommerce/includes/widgets/class-wc-widget-cart.php +++ b/plugins/woocommerce/includes/widgets/class-wc-widget-cart.php @@ -56,6 +56,8 @@ class WC_Widget_Cart extends WC_Widget { return; } + wp_enqueue_script( 'wc-cart-fragments' ); + $hide_if_empty = empty( $instance['hide_if_empty'] ) ? 0 : 1; if ( ! isset( $instance['title'] ) ) {