Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( $product_data && $product_data->get_type() == 'lottery' ) {
- update_post_meta( $order_id, '_lottery', '1' );
- add_post_meta( $product_id, '_order_id', $order_id );
- delete_post_meta( $product_id, '_order_hold_on', $order_id );
- $log_ids = array();
- /*if ( is_array( $true_answers_ids ) && ! in_array( $answer, $true_answers_ids ) ) {
- update_post_meta( $product_id, '_stock', $product_stock + $item_meta['_qty'][0]);
- }*/
- //else {
- for ( $i = 0; $i < $item_meta['_qty'][0]; $i++ ) {
- add_post_meta( $product_id, '_participant_id', $order->get_user_id() );
- $participants = get_post_meta( $product_id, '_lottery_participants_count', true ) ? get_post_meta( $product_id, '_lottery_participants_count', true ) : 0;
- update_post_meta( $product_id, '_lottery_participants_count', intval( $participants ) + 1 );
- $this->add_lottery_to_user_metafield( $product_id, $order->get_user_id());
- $log_ids[] = $this->log_participant( $product_id, $order->get_user_id(), $order_id, $item );
- $this->add_ticket_number($product_id, $order_billing_first_name, $order_billing_last_name, $answer, $order_id, $order->get_user_id());
- }
- //}
- do_action( 'wc_lottery_participate', $product_id, $order->get_user_id(), $order_id, $log_ids, $item, $item_id );
- $this->get_ticket_numbers($order->get_user_id(), $order_id, $product_id);
- $order->update_status( 'completed' );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement