How to programmatically add a blocked time slot after a booking?

  • Solved
  • Posted 1 month ago

Hello Voxel Team,

I have a question regarding Booking availability logic.

My Requirement: When a user books a time slot (e.g., 10:00 – 11:00), I need to programmatically add a “Cleaning Time” (block) immediately after that slot (e.g., 11:00 – 11:30) to prevent back-to-back bookings.

What I tried: I attempted to hook into voxel/product-types/orders/order:updated and manually insert a “blocked slot” (Availability Rule) into the post’s booking configuration.

I tried $post->update_field(‘product’, $config), but the custom availability rules array I added seems to be sanitized/removed by Voxel’s schema validation (as rules are not defined in the availability schema in Booking_Field).

I also tried using update_post_meta directly to bypass validation, followed by calling $booking_module->cache_fully_booked_dates(), but the calendar availability does not reflect these dynamically added blocks properly.

Question: Is there a recommended way (helper method, hook, or correct data structure) to programmatically block a specific time range for a product?

Thank you.