wpgenie

add meta fields to auction loop

Sep 28th, 2017
688
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

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×