wc block issue

This commit is contained in:
magepeopleteam 2021-10-05 11:30:59 +00:00
parent ea0a6c5db5
commit 608de5e4ee
1 changed files with 95 additions and 93 deletions

View File

@ -625,24 +625,29 @@ function mep_check_attendee_exist_before_create($order_id,$event_id){
}
add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 10);
if (!function_exists('mep_event_booking_management')) {
function mep_event_booking_management( $order_id) {
add_action('woocommerce_checkout_order_processed', 'mep_event_booking_management', 90);
add_action('__experimental_woocommerce_blocks_checkout_order_processed', 'mep_event_booking_management', 90);
// add_action('woocommerce_blocks_checkout_order_processed', 'mep_event_booking_management', 90);
if (!function_exists('mep_event_booking_management')) {
function mep_event_booking_management( $order_id) {
$result = !is_numeric($order_id) ? json_decode($order_id) : [0];
// $order_id = json_last_error() === JSON_ERROR_NONE ? $result->id : $order_id;
$order_id = !is_numeric($order_id) ? $result->id : $order_id;
if ( ! $order_id )
if ( ! $order_id )
{return;}
// Getting an instance of the order object
$order = wc_get_order( $order_id );
$order_meta = get_post_meta($order_id);
$order_status = $order->get_status();
if($order_status != 'failed'){
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
// Getting an instance of the order object
$order = wc_get_order( $order_id );
$order_meta = get_post_meta($order_id);
$order_status = $order->get_status();
if($form_position=='checkout_page'){
if($order_status != 'failed'){
$form_position = mep_get_option( 'mep_user_form_position', 'general_attendee_sec', 'details_page' );
if($form_position=='checkout_page'){
foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id;
@ -664,11 +669,9 @@ function mep_check_attendee_exist_before_create($order_id,$event_id){
}
if(is_array($user_info_arr) & sizeof($user_info_arr) > 0){
foreach ($user_info_arr as $_user_info) {
if($check_before_create < count($user_info_arr)){
mep_attendee_create('user_form',$order_id,$event_id,$_user_info);
}
}
}else{
foreach($event_ticket_info_arr as $tinfo){
@ -683,7 +686,8 @@ function mep_check_attendee_exist_before_create($order_id,$event_id){
}
}
}else{
}else{
foreach ( $order->get_items() as $item_id => $item_values ) {
$item_id = $item_id;
$event_id = wc_get_order_item_meta($item_id,'event_id',true);
@ -721,13 +725,11 @@ function mep_check_attendee_exist_before_create($order_id,$event_id){
}
} // end of check post type
}
}
do_action('mep_after_event_booking',$order_id,$order->get_status());
}
}
do_action('mep_after_event_booking',$order_id,$order->get_status());
}
}
}
function mep_delete_attandee_of_an_order($order_id,$event_id){