Help Center
Applying Price Filter Based on Seasonal and Weekend Rates

Applying Price Filter Based on Seasonal and Weekend Rates

This tutorial shows how to create a dynamic price filter for a WordPress website that reflects seasonal and weekend pricing in JetBooking.

Before you start, check the tutorial requirements:

  • Elementor (Free version) or WordPress Block editor (Gutenberg)

  • JetBooking plugin installed and activated

  • JetSmartFilters plugin installed and activated

This tutorial addresses the challenge of creating an accurate price filter for apartment listings when using advanced pricing rules in JetBooking. Since pricing can vary depending on the specific weekdays and seasonal periods with custom rates, a standard price filter may produce misleading results. We’ll show how to set up a dynamic filter that reflects true prices based on the seasonal settings.

Warning

Before proceeding with the tutorial′s steps, create a backup or replicate the actions on the staging site. The backup ensures that the website can be restored if an error occurs. To learn more, proceed to the How to Backup and Restore a WordPress Website with a Plugin article.

Create Filters

For this case, the “Date Range” and “Range” filters must be created.

Warning

The “Range” filter for prices can work without a “Date Range” filter, but it still relies on date values. If none are selected, the current date is used by default. For accurate results, it is recommended to filter by date first, then by price.

First, you can create a “Date Range” filter, which can be done by following the How to Apply JetSmartFilters to Your Booking Website tutorial.

date range filter

Next, you need to create a filter for the price range.

Open the WordPress Dashboard > Smart Filters > Add New page again. Enter the Filter Name (e.g., “Price Range”) and select the “Range” Filter Type.

The general filter settings can be customized based on the specific values you intend to filter.

price range filter

However, for proper functionality and further processing, you should set the Query Variable parameter. This should be a unique key, such as ‘_seasonal_price’.

query variable for the price range filter

Save the filter settings by pressing the “Update” button.

Add a Snippet

The hook can be added either via a custom code snippets plugin (like Code Snippets) or directly in your theme’s functions.php file (preferably in a child theme to prevent changes from being overwritten on updates).

For example, we install and activate the Code Snippets plugin, then proceed to the WordPress Dashboard > Snippets tab and click the “Add New” button.

We type the hook name into the title bar (e.g., “JetBooking – Price Filter Based on Selected Date Range”) and enter such code into the Functions (PHP) textarea:

Warning

Ensure to replace the _seasonal_price with the key set in the Query Variable bar for the “Range” filter.

hook for the price filter based on the selected date range

Now, we press the “Save Changes and Activate” button to save the snippet.

Place the Filters on the Archive Page

Edit the Archive page, where the list of booking properties is located.

For our case, we will use the page created in Elementor with the JetThemeCore plugin. For more details, see the How to Create an Archive for a Custom Post Type tutorial.

On the Archive page, we displayed a list of properties using the Listing Grid from the JetEngine plugin.

To show the range between the default and seasonal/weekend price in the Listing Grid, you can use the “Price per day/night” JetBooking Dynamic Tag. To apply it, we hover over the first listing item and press the “pencil” icon.

listing grid with properties

Now, we can edit the Listing Item template. Use a widget or block here that supports dynamic tags (e.g., Headline widget from JetElements or Heading).

Press the “database” icon and select the “Price per day/night” option in the JetBooking section from the dropdown menu.

price per day night dynamic tag for jetbooking

In the settings pop-up, pick the “Prices range” option from the Show price dropdown. In this way, the min and max property prices will be displayed.

Press the “Publish” button to save the changes, hover over the first listing item again, and push the “return” icon to go back to the Archive page.

jetbooking prices range per day or night

Then, add the Date Range Filter, Range Filter, and Apply Button to the page.

For the Date Range Filter, set the required filter in the Select filter dropdown, pick the filter provider from the This filter for dropdown (“JetEngine” in our case), and enable the Hide apply button toggle (since we use a separate widget as an “Apply Filters” button, we don’t need another one for this filter).

date range filter for properties

For the Range Filter, set the required filter in the Select filter dropdown, pick the filter provider from the This filter for dropdown (“JetEngine” in our case), and select the “Click on apply button” option from the Apply on dropdown.

range filter for properties

For the Apply Button, only the filter provider should be chosen from the This filter for dropdown.

apply filters button settings

After the Archive page is set, you can save the modifications.

Check the Results

Proceed to the properties list on the front end to test the filters. For one of the properties, we set the weekend price: on Mondays, the price is $20, and for other days, it’s $24.

weekend price for the property

Let’s imagine we want to rent a property for no more than $20 per night, but only on Friday.

We apply the filters and see that the “Rainforest Guest House” property is not available for Friday at the desired price.

filter results depend on the seasonal and weekend prices

That’s all. Now you know how to create a dynamic price “Range” filter for a WordPress website that reflects seasonal and weekend pricing in JetBooking.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

Get answers from 30K+ Crocoblock Community experts from all over the world.

Start a live chat

Ask question to support agent and share its details via chat messages.