Help Center
How to Display Items’ Availability Status Dynamically

How to Display Items’ Availability Status Dynamically

From this guide, you will discover how to show whether items are available or reserved on your website with JetBooking for WordPress.

Before you start, check the tutorial requirements:

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

  • JetEngine plugin installed and activated

  • JetBooking plugin installed and activated with some bookings made on the website

Let’s find out how to display the availability status of the booking instance post type posts. In our case, we have a car rental website and want to showcase the presented cars with their booking status below.

So, there will be three statuses: “Available,” “Available on” (shown if the car is booked for less than seven days starting from today), and “Reserved” (shown if the car is booked for more than seven days starting from today).

Things to know

This tutorial is made based on the RentGo dynamic template available during the Crocoblock installation.

We want to display the availability status in the Listing Grid, where all the cars will be presented. So, first, we should build/edit a Listing template.

Build a Listing

Head to WordPress Dashboard > JetEngine > Listings/Components. Here, select the already-built Listing item and press the corresponding button to edit it. Or, build a listing from scratch by pressing the “Add New Listing Item” button at the top of the page.

We open the listing built beforehand with Elementor. However, you can edit your listing in the Block Editor if you prefer.

Our Listing item includes the following widgets:

listing item for a car
  • Dynamic Image — a picture of a car;
  • Dynamic Link — the name of the car model;
  • Dynamic Field — a year when the car was manufactured;
  • Headline — a notice about the cancellation policy; 
  • Icon List — a list of the car characteristics with their icon indicators;
  • Headline — a price per day;
  • Dynamic Link — a “Rent Now” button.

We also add a Heading widget to display the booking availability status. However, you can add any other widget that supports dynamic macros using.

Click the “Dynamic Tags” button next to the Title field and select the “Accommodation Status” macro (JetBooking section.)

Then, press the just-selected macro name to open its settings. Here, you can change the default values put in the Available Label, Pending Label, and Reserved Label fields.

heading accomodation status settings

Adjust the Style settings and press the “Update” button to save the listing.

heading style settings
Things to know

The same settings can be adjusted in the Block Editor, similarly to Elementor. Just press the “Dynamic Tags” button above the fields to access the macro and its settings.

booking accommodation status in gutenberg

The “Booking Accommodation Status” macro can also be adjusted and generated with the JetEngine’s Macros Generator.

You can adjust the Available Label, Pending Label, and Reserved Label there. You can also set the Context and the Fallback.

The macro itself can be copied below.

booking accommodation status settings

Place Listing on the Page

Proceed to WordPress Dashboard > Pages and open the page where you want the Listing Grid to be displayed. Alternatively, you can create a new page by pressing the corresponding button at the top of the page.

In the page editor, find and place the Listing Grid widget/block/element on the page.

Select the just-edited Listing.

listing grid widget in elementor

Customize the page additionally if needed and press the “Publish/Update” button.

Things to know

If you want to style the availability statuses, you can add the needed CSS code in the WordPress Dashboard > Appearance > Customize > Additional CSS directory.

For instance, we add a CSS code to change the color of the text depending on the set status:

span.status.available {
	color: #00ff00
}

span.status.reserved {
	color: #ff0000
}

span.status.pending {
	color: #0000ff
}
additional css page

Check the Result

Open the page on the front end. Now, you can observe that the listing items have different text displayed depending on their availability status.

Things to know

If there are no bookings made on your website, you will get an “Available” status for every post.

front end result

That’s all; now you know how to show the availability status of the booking items built with the JetBooking plugin for WordPress.

Was this article helpful?
YesNo

Need help?

Ask Facebook community

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

Start a live chat

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