wpgenie

extend auction end time on every bid placed

Mar 13th, 2018
1,234
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_action( 'woocommerce_simple_auctions_outbid', 'woocommerce_simple_auctions_extend_time', 50 );
  2. add_action( 'woocommerce_simple_auctions_proxy_outbid', 'woocommerce_simple_auctions_extend_time', 50 );
  3.  
  4. function woocommerce_simple_auctions_extend_time($data){
  5.     $product = get_product( $data['product_id'] );
  6.     if ('auction' === $product->get_type() ){
  7.         $date1 = new DateTime($product->get_auction_dates_to());
  8.         $date1->add(new DateInterval('PT30S'));
  9.         update_post_meta( $data['product_id'], '_auction_dates_to', $date1->format('Y-m-d H:i:s') );
  10.     }
  11. }
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.

×