By default, Woocommerce Bookings works well with our plugin, but there are certain features that might need some special treatment.
Down below you will find a list with all of our available integrations for Woocommerce Bookings.
Add Woocommerce Booking Post Statuses to WP Webhooks and WP Webhooks Pro
By default, most of the Woocommerce Booking Post Statuses are not available within our plugin. This is due to the fact that WC Bookings uses its own logic to register these post statuses.
With the function down below, you will be able to use all of WC Bookings post statuses within WP Webhooks and WP Webhooks Pro
How to use this code:
Simply copy it and paste it within your child themes functions.php file. There is no need to modify the code by default. Explanations to the code are within the comments of it.
add_filter( 'wpwhpro/admin/settings/get_all_post_statuses', 'wpwh_add_wc_booking_statuses', 20, 1 ); function wpwh_add_wc_booking_statuses( $status_array ){ //This is necessary to make sure we only use this logic if Woocommerce Bookings is active if( ! function_exists( 'get_wc_booking_statuses' ) ){ return $status_array; } /* * The context defines every single context within the Woocommerce * Bookings function. It means we grab every available status and add it * to all available statuses. * * Defined in: wp-content/plugins/woocommerce-bookings/includes/wc-bookings-functions.php:173 */ $contexts = array( 'fully_booked', 'user', 'cancel', 'scheduled' ); foreach( $contexts as $context ){ $booking_status = get_wc_booking_statuses( $context, true ); //True for returning the labels as well if( ! empty( $booking_status ) && is_array( $booking_status ) ){ foreach( $booking_status as $bkey => $blabel ){ if( ! isset( $status_array[ $bkey ] ) ){ $status_array[ $bkey ] = $blabel; } } } } return $status_array; }