wpgenie

custom_woocommerce_get_price_html

May 24th, 2018
831
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.15 KB | None | 0 0
  1. add_filter( 'woocommerce_get_price_html' , 'custom_woocommerce_get_price_html', 90,2);
  2.  
  3. function woocommerce_get_price_html($price , $product) {
  4.  
  5.     $id = $product->get_main_wpml_product_id();
  6.  
  7.     if ($product->is_closed() && $product->is_started() ){
  8.         if ($product->get_auction_closed() == '3'){
  9.             $price = __('<span class="sold-for auction">Sold for</span>: ','wc_simple_auctions').wc_price($product->get_price());
  10.         }
  11.         else{
  12.             if ($product->get_auction_current_bid()){
  13.                 if ( $product->is_reserve_met() == FALSE){
  14.                     $price = __('<span class="winned-for auction">Auction item did not make it to reserve price</span> ','wc_simple_auctions');
  15.                 } else{
  16.                     $price = __('<span class="winned-for auction">Winning Bid:</span> ','wc_simple_auctions').wc_price($product->get_auction_current_bid());
  17.                 }
  18.             }
  19.             else{
  20.                 $price = __('<span class="winned-for auction">Auction Ended</span> ','wc_simple_auctions');
  21.             }
  22.  
  23.  
  24.         }
  25.  
  26.     } elseif(!$product->is_started()){
  27.         $price = '<span class="auction-price starting-bid" data-auction-id="'.$id.'" data-bid="'.$product->get_auction_current_bid().'" data-status="future">'.__('<span class="starting auction">Starting bid:</span> ','wc_simple_auctions').wc_price($product->get_curent_bid()).'</span>';
  28.     } else {
  29.         if($product->get_auction_sealed() == 'yes'){
  30.             $price = '<span class="auction-price" data-auction-id="'.$id.'"  data-status="running">'.__('<span class="current auction">This is sealed bid auction.</span> ','wc_simple_auctions').'</span>';
  31.         } else{
  32.             if (!$product->get_auction_current_bid()){
  33.                 $price = '<span class="auction-price starting-bid" data-auction-id="'.$id.'" data-bid="'.$product->get_auction_current_bid().'" data-status="running">'.__('<span class="current auction">Starting bid:</span> ','wc_simple_auctions').wc_price($product->get_curent_bid()).'</span>';
  34.             } else {
  35.                 $price = '<span class="auction-price current-bid" data-auction-id="'.$id.'" data-bid="'.$product->get_auction_current_bid().'" data-status="running">'.__('<span class="current auction">Current bid:</span> ','wc_simple_auctions').wc_price($product->get_curent_bid()).'</span>';
  36.             }
  37.         }
  38.  
  39.     }
  40.  
  41.     return $price;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment