daily pastebin goal
19%
SHARE
TWEET

faq29 I want to add bid button everywhere not only on single

wpgenie Mar 13th, 2018 (edited) 189 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_action( 'woocommerce_after_shop_loop_item_title', 'wpgenie_add_bid_button',50 );
  2. function wpgenie_add_bid_button(){
  3.  
  4.     global $woocommerce, $product, $post;
  5.  
  6.  
  7.      if(($product->is_closed() === FALSE ) and ($product->is_started() === TRUE )) :
  8.  
  9.          do_action('woocommerce_before_bid_form'); ?>
  10.         <form class="auction_form cart" method="post" enctype='multipart/form-data' data-product_id="<?php echo $product->get_id(); ?>">
  11.  
  12.             <?php do_action('woocommerce_before_bid_button'); ?>
  13.  
  14.             <input type="hidden" name="bid" value="<?php echo esc_attr( $product->get_id() ); ?>" />
  15.             <?php if($product->auction_type == 'reverse' ) : ?>
  16.                 <div class="quantity buttons_added">
  17.                     <input type="button" value="+" class="plus" />
  18.                     <input type="number" name="bid_value" data-auction-id="<?php echo esc_attr( $product->get_id() ); ?>" value="<?php echo $product->bid_value() ?>" max="<?php echo $product->bid_value()  ?>"  step="any" size="<?php echo strlen($product->get_curent_bid())+2 ?>" title="bid"  class="input-text  qty bid text left">
  19.                     <input type="button" value="-" class="minus" />
  20.                     <button type="submit" class="bid_button button alt"><?php echo apply_filters('bid_text', __( 'Bid', 'wc_simple_auctions' ), $product->get_type()); ?></button>
  21.                  </div>
  22.             <?php else : ?>
  23.                 <div class="quantity buttons_added">
  24.                     <input type="button" value="+" class="plus" />
  25.                     <input type="number" name="bid_value" data-auction-id="<?php echo esc_attr( $product->get_id()); ?>" value="<?php echo $product->bid_value()  ?>" min="<?php echo $product->bid_value()  ?>"  step="any" size="<?php echo strlen($product->get_curent_bid())+2 ?>" title="bid"  class="input-text qty  bid text left">
  26.                     <input type="button" value="-" class="minus" />
  27.                 </div>
  28.             <button type="submit" class="bid_button button alt"><?php echo apply_filters('bid_text', __( 'Bid', 'wc_simple_auctions' ), $product->get_type() ); ?></button>
  29.             <?php endif; ?>
  30.  
  31.             <input type="hidden" name="place-bid" value="<?php echo $product->get_id(); ?>" />
  32.             <input type="hidden" name="product_id" value="<?php echo esc_attr( $product->get_id()); ?>" />
  33.             <?php if ( is_user_logged_in() ) { ?>
  34.                 <input type="hidden" name="user_id" value="<?php echo  get_current_user_id(); ?>" />
  35.             <?php  } ?>
  36.             <?php do_action('woocommerce_after_bid_button'); ?>
  37.         </form>
  38.  
  39.  
  40.         <?php do_action('woocommerce_after_bid_form');
  41.  
  42.      endif;
  43.  
  44. }
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