Booking Filters for WooCommerce

Booking Filters for WooCommerce v1.2.0.22

No permission to download

deo

Member
Babiato Lover
Oct 7, 2019
44
53
18
deo submitted a new resource:

Booking Filters for WooCommerce - Give your customers the ability to search and filter bookable products

Booking filters make it easy for your customers to find what they want by allowing them to filter bookable products based on date, time and other attributes.


Improve the user experience of your Bookings site and allow customers to easily find what they want with these intuitive booking filters!

Give your customers the ability to search and filter bookable products based on their own time availability and other attributes.

Booking Filters for WooCommerce is an add-on for...

Read more about this resource...
 
  • Love
Reactions: tanierlyons

deo

Member
Babiato Lover
Oct 7, 2019
44
53
18
Hi guys, this plugin is not compatible with Booking Check In restriction days or "WooCommerce Accommodation Bookings" plugin, so I hired a developer to make this tool compatible with those.
I share with you the code:

// Search filter fix for Check In restriction days & WooCommerce Accommodation Bookings add_action( 'elementor/query/alquil_custom_bookings_filter', function( $query ) { if( isset( $_GET['start_date'] ) && isset( $_GET['end_date']) ) { if ($_GET['start_date'] != '' && $_GET['end_date'] != '') { //$start_date = str_replace('/', '-',$_GET['start_date']); // $end_date = str_replace('/', '-',$_GET['end_date']); if ( 'd/m/Y' == get_option( 'date_format', true ) ) { $start_date = gmdate( 'Y-m-d', strtotime( str_replace( '/', '-', $_GET['start_date'] ) ) ); $end_date = gmdate( 'Y-m-d', strtotime( str_replace( '/', '-', $_GET['end_date'] ) ) ); } else{ $start_date = gmdate( 'Y-m-d', strtotime($_GET['start_date'] ) ); $end_date = gmdate( 'Y-m-d', strtotime( $_GET['end_date'] ) ); } $day_of_the_week = date('w', strtotime($start_date)); $num_days = (strtotime($end_date) - strtotime($start_date)) / (60 * 60 * 24); $meta_query[] = $query->get( 'meta_query'); $meta_query[] = [ 'key' => '_wc_booking_min_duration', 'value' => $num_days, 'compare' => '<=', 'type' => 'NUMERIC' ]; $meta_query[] = [ 'key' => '_wc_booking_max_duration', 'value' => $num_days, 'compare' => '>=', 'type' => 'NUMERIC' ]; $meta_query[] = array ( 'relation' => 'OR', array ( 'key' => '_wc_booking_restricted_days', 'value' => '"'.$day_of_the_week.'"', 'compare' => 'LIKE' ), array ( 'key' => '_wc_booking_has_restricted_days', 'value' => '1', 'compare' => '!=' ), ); $query->set( 'meta_query', $meta_query ); } } } );


Also, I share a function to include the total cost of the Booking the user is searching for:


// Add the total cost of the search in the results function alq_search_item_totals($post) { global $post; $booking_total_cost_html = ''; if( isset( $_GET['start_date'] ) && isset( $_GET['end_date']) ) { if ( 'd/m/Y' == get_option( 'date_format', true ) ) { $start_date = gmdate( 'Y-m-d', strtotime( str_replace( '/', '-', $_GET['start_date'] ) ) ); $end_date = gmdate( 'Y-m-d', strtotime( str_replace( '/', '-', $_GET['end_date'] ) ) ); } else{ $start_date = gmdate( 'Y-m-d', strtotime($_GET['start_date'] ) ); $end_date = gmdate( 'Y-m-d', strtotime( $_GET['end_date'] ) ); } $product = wc_get_product($post->ID); $booking_data = array(); $booking_data['_persons'] = 1; $booking_data['_start_date'] = strtotime($start_date.' 12:00'); $booking_data['_end_date'] = strtotime($end_date); $booking_data['date'] = strtotime($start_date); //$booking_data['_resource_id'] =''; //$booking_data['_qty'] = 1; $booking_data['_duration'] = (strtotime($end_date) - strtotime($start_date)) / (60 * 60 * 24); if (class_exists( 'WC_Bookings_Cost_Calculation')){ $cost = WC_Bookings_Cost_Calculation::calculate_booking_cost( $booking_data, $product ); if ($cost && ! is_wp_error( $cost )) { $booking_cost = $cost; $booking_cost = apply_filters( 'formatted_woocommerce_price', number_format( $booking_cost, wc_get_price_decimals(), wc_get_price_decimal_separator(), wc_get_price_thousand_separator()), $booking_cost, wc_get_price_decimals(), wc_get_price_decimal_separator(), wc_get_price_thousand_separator()); $formatted_price = sprintf( get_woocommerce_price_format(), '<span class="woocommerce-Price-currencySymbol">' . get_woocommerce_currency_symbol('') . '</span>', $booking_cost ); $booking_total_cost_html .= '<div class="results-Totals"><span>Total: </span>'.$formatted_price.'</div>'; } } } return $booking_total_cost_html; } add_shortcode('search_item_totals', 'alq_search_item_totals');


Cheers.
 

eimvaid

New member
May 11, 2022
2
0
1
Does anyone have v1.2.0.30?
This version (1.2.0.22) is not compatible with resources. Wondering if 1.2.0.30 fixed it...
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu