SHARE
TWEET

faq 11 woo pre 2.7

wpgenie Mar 13th, 2018 191 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_action( 'woocommerce_after_shop_loop_item_title','wpgenie_show_counter_in_loop',50 );
  2.  
  3. function wpgenie_show_counter_in_loop(){
  4.  
  5.     global $product;
  6.  
  7.     $time = '';
  8.  
  9.     if(!isset ($product))
  10.         return;
  11.     if('auction' != $product->product_type)
  12.         return;
  13.  
  14.     $timetext = __('Time left', 'wc_simple_auctions');
  15.  
  16.     if(!$product->is_started()){
  17.         $timetext = __('Starting in', 'wc_simple_auctions');
  18.         $counter_time = $product->get_seconds_to_auction();
  19.     } else{
  20.         $counter_time = $product->get_seconds_remaining();
  21.     }
  22.  
  23.     $time = '<span class="time-left">'.$timetext.'</span>
  24.     <div class="auction-time-countdown"
  25.     data-time="'.$counter_time.'"
  26.     data-auctionid="'.$product->id.'" data-format="'.get_option(
  27.     'simple_auctions_countdown_format' ).'"></div>';
  28.  
  29.     if($product->is_closed()){
  30.         $time = '<span class="has-finished">'.__('Auction finished','wc_simple_auctions').'</span>';
  31.     }
  32.     echo $time;
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top