From aa913b59ed56cf65fc37490c1c280d67ae901c8d Mon Sep 17 00:00:00 2001 From: Khoi Nguyen Date: Thu, 6 May 2021 22:22:58 +0700 Subject: [PATCH] Set loop prop to widget products to set condition on single product page --- includes/widgets/class-wc-widget-products.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/widgets/class-wc-widget-products.php b/includes/widgets/class-wc-widget-products.php index be373488920..4d5b61240a7 100644 --- a/includes/widgets/class-wc-widget-products.php +++ b/includes/widgets/class-wc-widget-products.php @@ -186,6 +186,8 @@ class WC_Widget_Products extends WC_Widget { ob_start(); + wc_set_loop_prop( 'name', 'widget' ); + $products = $this->get_products( $args, $instance ); if ( $products && $products->have_posts() ) { $this->widget_start( $args, $instance );