daily pastebin goal
54%
SHARE
TWEET

faq13

wpgenie Mar 13th, 2018 (edited) 353 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Auto Extend Auction by 2 min when a bid is placed within the last 5mins */
  2. add_action( 'woocommerce_simple_auctions_outbid', 'woocommerce_simple_auctions_extend_time', 50 );
  3.  
  4. function woocommerce_simple_auctions_extend_time($data) {
  5.  
  6.     $product = get_product( $data['product_id'] );
  7.  
  8.     if ('auction' === $product->get_type() ) {
  9.         $auctionend = new DateTime($product->get_auction_dates_to());
  10.         $auctionendformat = $auctionend->format('Y-m-d H:i:s');
  11.         $time = current_time( 'timestamp' );
  12.         $timeplus5 = date('Y-m-d H:i:s', strtotime('+5 minutes', $time));
  13.  
  14.         if ($timeplus5 > $auctionendformat) {
  15.             $auctionend->add(new DateInterval('PT120S'));
  16.             update_post_meta( $data['product_id'], '_auction_dates_to', $auctionend->format('Y-m-d H:i:s') );
  17.         }
  18.     }
  19. }
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