SHARE
TWEET

Add meta fields to auction loop

wpgenie Sep 28th, 2017 (edited) 200 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 );
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