Advertisement
wpgenie

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

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