wpgenie icon

add meta fields to auction loop

wpgenie | PRO | 09/28/17 07:20:28 AM UTC | 0 ⭐ | 2618 👁️ | Never ⏰ | []
PHP |

850 B

|

None

|

0 👍

/

0 👎

function wpgenie_shop_display_post_meta() {
 
    global $product;
    
    if($product && $product->get_type() == 'auction'){
  
        if ( ! empty( $product->get_auction_start_price() ) ) {
            echo '<div class="product-meta"><span class="product-meta-title">Starting price:</span> ' .  wc_price( $product->get_auction_start_price() ) . '</div>';
        }
 
        if ( ! empty( $product->get_auction_current_bid() ) ) {
            echo '<div class="product-meta"><span class="product-meta-title">Current pice:</span> ' . wc_price( $product->get_auction_current_bid() ) . '</div>';
        }
 
        if ( ! empty( $product->get_auction_max_bid() ) ) {
            echo '<div class="product-meta"><span class="product-meta-title">User max bid:</span> ' . wc_price( $product->get_auction_max_bid() ) . '</div>';
        }
 
    }
}
add_action( 'woocommerce_after_shop_loop_item', 'wpgenie_shop_display_post_meta', 9 );

Comments