• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Booking Filters for WooCommerce

Booking Filters for WooCommerce v1.2.0.22

No permission to download

deo

Member
Babiato Supporter
Babiato Lover
Oct 7, 2019
57
83
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
  • Like
Reactions: emisansev and Babak
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.
 
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...
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock