View difference between Paste ID: ifa8vZvh and gavzf7bz
SHOW: | | - or go back to the newest paste.
1-
/* available as plugin https://wpgenie.org/woocommerce-lottery/documentation/assets/woocommerce-lottery-progress-bar-in-loop.zip */
1+
2
3
		function wpgenie_show_counter_in_loop(){
4
5
			global $product;
6
7
			$time = '';
8
9
			if(!isset ($product))
10
				return;
11
			if('groupbuy' != $product->get_type())
12
				return;
13-
			if('lottery' != $product->get_type())
13+
14
			$timetext = __('Time left', 'wc_groupbuy');
15
16-
			$timetext = __('Time left', 'wc_lottery');
16+
17
				$timetext = __('Starting in', 'wc_groupbuy');
18
				$counter_time = $product->get_seconds_to_groupbuy();
19-
				$timetext = __('Starting in', 'wc_lottery');
19+
20-
				$counter_time = $product->get_seconds_to_lottery();
20+
21
			}
22
23
			$time = '<span class="time-left">'.$timetext.'</span>
24
			<div class="groupbuy-time-countdown"
25
			data-time="'.$counter_time.'"
26-
			<div class="lottery-time-countdown"
26+
			data-groupbuyid="'.$product->get_id().'" data-format="'.get_option(
27
			'simple_groupbuy_countdown_format' ).'"></div>';
28-
			data-lotteryid="'.$product->get_id().'" data-format="'.get_option(
28+
29-
			'simple_lottery_countdown_format' ).'"></div>';
29+
30
				$time = '<span class="has-finished">'.__('Group Buy deal finished','wc_groupbuy').'</span>';
31
			}
32-
				$time = '<span class="has-finished">'.__('Lottery finished','wc_lottery').'</span>';
32+
33
		}