Advertisement
wpgenie

add meta fields to auction loop

Sep 28th, 2017
1,986
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. function wpgenie_shop_display_post_meta() {
  2.  
  3.     global $product;
  4.    
  5.     if($product && $product->get_type() == 'auction'){
  6.  
  7.         if ( ! empty( $product->get_auction_start_price() ) ) {
  8.             echo '<div class="product-meta"><span class="product-meta-title">Starting price:</span> ' .  wc_price( $product->get_auction_start_price() ) . '</div>';
  9.         }
  10.  
  11.         if ( ! empty( $product->get_auction_current_bid() ) ) {
  12.             echo '<div class="product-meta"><span class="product-meta-title">Current pice:</span> ' . wc_price( $product->get_auction_current_bid() ) . '</div>';
  13.         }
  14.  
  15.         if ( ! empty( $product->get_auction_max_bid() ) ) {
  16.             echo '<div class="product-meta"><span class="product-meta-title">User max bid:</span> ' . wc_price( $product->get_auction_max_bid() ) . '</div>';
  17.         }
  18.  
  19.     }
  20. }
  21. add_action( 'woocommerce_after_shop_loop_item', 'wpgenie_shop_display_post_meta', 9 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement