/* show flip countdown timer in product archive / loop - works only with https://wpgenie.org/product/flip-countdown-timer-for-woocommerce-lottery/ WooCommerce Lottery addon! */
add_action( 'woocommerce_after_shop_loop_item_title','wpgenie_show_counter_in_loop_flip', 51 );
function wpgenie_show_counter_in_loop_flip(){
global $product;
$time = '';
if(!isset ($product))
return;
if('lottery' != $product->get_type())
return;
if(!$product->is_started()){
$timetext = __('Starting in', 'wc_lottery');
$counter_time = $product->get_seconds_to_lottery();
} else{
$counter_time = $product->get_seconds_remaining();
}
if ( ( $product->is_closed() === FALSE ) && ($product->is_started() === TRUE ) ) : ?>
<div class="tick" data-date="<?php echo $product->get_lottery_dates_to(); ?>"
data-did-init="handleTickInit">
<div data-repeat="true"
data-layout="horizontal center fit"
data-transform="preset(h, m, s) -> delay">
<div class="tick-group">
<div data-key="value"
data-repeat="true"
data-transform="pad(00) -> split -> delay">
<span data-view="flip"></span>
</div>
<span data-key="label"
data-view="text"
class="tick-label"></span>
</div>
</div>
</div>
<?php
endif;
}
Comments