Skip to content

Instantly share code, notes, and snippets.

@WillBrubaker
Created March 15, 2018 13:54
Show Gist options
  • Save WillBrubaker/5f68faf90dc9c164234326725e0fa15f to your computer and use it in GitHub Desktop.
Save WillBrubaker/5f68faf90dc9c164234326725e0fa15f to your computer and use it in GitHub Desktop.
WooCommerce Bookings: Remove all available blocks for the day if one is booked
//Don't know what to do with this? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'wc_bookings_product_get_available_blocks', 'beardedguy_maybe_remove_availability', 10, 5 );
function beardedguy_maybe_remove_availability( $available_blocks, $booking_object, $blocks, $intervals, $resource_id ) {
return ( sizeof( $available_blocks ) < sizeof( $blocks ) ) ? array() : $available_blocks;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment