Skip to content

Instantly share code, notes, and snippets.

@thisissandip
thisissandip / booking-creation-logger.php
Last active April 7, 2025 10:42
booking-creation-logger: Logs details of the new booking in WooCommerce > status > logs
/**
* Monitor new booking creation using wc_get_logger
*/
function log_all_new_bookings( $booking_id ) {
if ( ! function_exists( 'get_wc_booking' ) ) {
return;
}
$booking = get_wc_booking( $booking_id );
@thisissandip
thisissandip / snippet.php
Last active July 19, 2025 06:02
WooCommerce Bookings: Auto Add 1-Hour Buffer After Booking Ends for Resource Availability
<?php
/*
Add a 1-hour buffer period to resource availability AFTER a paid booking ends by blocking availability
from the booking's end time to 1 hour later. This prevents back-to-back bookings.
*/
function auto_create_one_hour_buffer_availability_resource($booking_id) {
$booking = new WC_Booking($booking_id);