How to create reservations programmatically WooCommerce Bookings? [closed]

Question

CRM Bitrix24 sends an array with reservation data (‘TITLE’ = ‘Add reservation’, ‘ZONE’ = ‘PROMO HALL’, ‘DATE_FROM’ = 17.12.2020 18:00 ‘DATE_TO’ = 17.12.2020 20:00), how to implement creating and removing armor?
Found just such an article enter link description here, am I looking in the right direction?

function auto_create_followup_booking ($ booking_id) {
$new_booking_data = array(
        'product_id'  => $product_id,
        'title' => '',
        'zone' => '',
        'date_from'  => '',
        'date_to'    => '',
);
$status = 'confirmed';
$exact = false;
create_wc_booking( $product_id, $new_booking_data, $status, $exact );
}

add_action ('woocommerce_booking_in-cart_to_paid', 'auto_create_followup_booking');
add_action ('woocommerce_booking_unpaid_to_paid', 'auto_create_followup_booking');
add_action ('woocommerce_booking_confirmed_to_paid', 'auto_create_followup_booking');
0
WPTricks 1 month 0 Answers 5 views 0

Leave an answer