I have a form on a website that allows users to create bookable products. However, I can't find how to create a availability interval using Woocommerce php functions. Does anyone have an idea?
Here's how I create my product
$post_id = wp_insert_post( array(
'post_title' => $_POST["title"],
'post_content' => $_POST["description"],
'post_status' => 'publish',
'post_type' => "product",
) );
wp_set_object_terms( $post_id, 'booking', 'product_type' );
In another part of this same project, I use the get_post_meta function to get the availabilities. I get that the availabilities are meta data from the post but I'm not exacly sure how to change these. I tried using the usual add_post_meta( $post_id, '_wc_booking_availability', $availability );
but that didn't work. Is there something I'm missing about Woocommerce availabilities?
On a side note, is there a more detailed documentation of Woocommerce Booking?
The developer documentation on their website only covers the basics of creating a product programmatically.