SHARE
TWEET

Untitled

a guest Apr 18th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.                     if ( $product_data && $product_data->get_type() == 'lottery' ) {
  3.                         update_post_meta( $order_id, '_lottery', '1' );
  4.                         add_post_meta( $product_id, '_order_id', $order_id );
  5.                         delete_post_meta( $product_id, '_order_hold_on', $order_id );
  6.  
  7.                         $log_ids = array();
  8.  
  9.               /*if ( is_array( $true_answers_ids ) && ! in_array( $answer, $true_answers_ids ) ) {
  10.                   update_post_meta( $product_id, '_stock', $product_stock + $item_meta['_qty'][0]);
  11.               }*/
  12.  
  13.               //else {
  14.               for ( $i = 0; $i < $item_meta['_qty'][0]; $i++ ) {
  15.                   add_post_meta( $product_id, '_participant_id', $order->get_user_id() );
  16.                               $participants = get_post_meta( $product_id, '_lottery_participants_count', true ) ? get_post_meta( $product_id, '_lottery_participants_count', true ) : 0;
  17.                                 update_post_meta( $product_id, '_lottery_participants_count', intval( $participants ) + 1 );
  18.  
  19.                                 $this->add_lottery_to_user_metafield( $product_id, $order->get_user_id());
  20.                                 $log_ids[] = $this->log_participant( $product_id, $order->get_user_id(), $order_id, $item );
  21.                   $this->add_ticket_number($product_id, $order_billing_first_name, $order_billing_last_name, $answer, $order_id, $order->get_user_id());
  22.                 }
  23.               //}
  24.  
  25.                         do_action( 'wc_lottery_participate', $product_id, $order->get_user_id(), $order_id, $log_ids, $item, $item_id );
  26.  
  27.             $this->get_ticket_numbers($order->get_user_id(), $order_id, $product_id);
  28.  
  29.             $order->update_status( 'completed' );
  30.  
  31.                     }
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