wpgenie icon

custom_woocommerce_get_price_html

wpgenie | PRO | 05/24/18 07:47:52 AM UTC | 0 ⭐ | 1212 👁️ | Never ⏰ | []
PHP |

2.15 KB

|

None

|

0 👍

/

0 👎

add_filter( 'woocommerce_get_price_html' , 'custom_woocommerce_get_price_html', 90,2);
 
function woocommerce_get_price_html($price , $product) {
 
    $id = $product->get_main_wpml_product_id();
 
    if ($product->is_closed() && $product->is_started() ){
        if ($product->get_auction_closed() == '3'){
            $price = __('<span class="sold-for auction">Sold for</span>: ','wc_simple_auctions').wc_price($product->get_price());
        }
        else{
            if ($product->get_auction_current_bid()){
                if ( $product->is_reserve_met() == FALSE){
                    $price = __('<span class="winned-for auction">Auction item did not make it to reserve price</span> ','wc_simple_auctions');
                } else{
                    $price = __('<span class="winned-for auction">Winning Bid:</span> ','wc_simple_auctions').wc_price($product->get_auction_current_bid());
                }
            }
            else{
                $price = __('<span class="winned-for auction">Auction Ended</span> ','wc_simple_auctions');
            }
 
 
        }
 
    } elseif(!$product->is_started()){
        $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>';
    } else {
        if($product->get_auction_sealed() == 'yes'){
            $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>';
        } else{
            if (!$product->get_auction_current_bid()){
                $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>';
            } else {
                $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>';
            }
        }
 
    }
 
    return $price;
}

Comments