Skip to content

Commit db4bc63

Browse files
authored
load wc-cart-fragments-script when the widget cart is active (#2115)
1 parent c785e00 commit db4bc63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

inc/class-storefront.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ public function scripts() {
378378
}
379379

380380
/**
381-
* Limit Cart Sync functionality to specific WooCommerce pages
381+
* Limit Cart Sync functionality to specific WooCommerce pages or when the Widget Cart is active.
382382
* More details: https://developer.woocommerce.com/2023/06/16/best-practices-for-the-use-of-the-cart-fragments-api/
383383
*
384384
* @param string $script_data The script data.
@@ -387,7 +387,7 @@ public function scripts() {
387387
*/
388388
public function limit_cart_sync_to_wc_pages( $script_data, $handle ) {
389389
if ( 'wc-cart-fragments' === $handle ) {
390-
if ( is_woocommerce() || is_cart() || is_checkout() ) {
390+
if ( is_woocommerce() || is_cart() || is_checkout() || is_active_widget( false, false, 'woocommerce_widget_cart', true ) ) {
391391
return $script_data;
392392
}
393393
return null;

0 commit comments

Comments
 (0)