Surfacing Custom Attributes in the Booking Module (Liquid)


Liquid Views 

If you have gone through the process of creating one or more custom attributes for you listing form, you may be asking yourself what can be done with that information after a user submits that listing.

When a user creates a new listing and fills out the custom attributes that you have added, you can surface that information on the listing page itself in what we refer to as the booking module - or the large black box on the right hand side of the listing page. Depending on the layout you have set up for listing pages, you may also be able to surface that information elsewhere on the page using the same liquid tags that we have documented below.

To surface your custom listing attributes in the booking module:
1) Start by logging into your admin dashboard, and navigating to Theme > Liquid Views - here you will find (under the 'Customize Defaults' list) all the views on your marketplace that are customizable using HTML, CSS, and Liquid.

2) Find and select 'Listings > Booking Module Listing Description' in the Customize Defaults list - this will take you to a page where you can customize the 'Listing description' area of the booking module where we are going to put our custom attributes.
3) On this page, you can select the service type that this should be applied to (if you have more than one service type - which by default you only have one), and then under that in the 'Body' field is where you will include any new HTML or Liquid.
 To surface our custom attribute, you will want to place the following anywhere in this view that you want it to show up: 

{{ listing.properties.[attribute] }} 

Where [attribute] is the name of the attribute you set. For instance, if we had an attribute named 'test', this would look like{{ listing.properties.test }} as shown on line 2 of the image below:

4) Now, when you save, any listings where users have filled that field out will display this information in the booking module. 

 But what if the attribute is not required, and users don't fill it out? You can use a conditional statement in liquid to ensure that this only shows up if the information exists. This would look like:
{% unless listing.properties.test == blank %}   <p> {{ listing.properties.test }} </p> {% endunless %}
Now the system will check to see if that attribute is blank, and unless it is blank, it will be displayed in the booking module. This can be useful if you want to label your custom attributes when you surface them, such as:
{% unless listing.properties.test == blank %}   <h1> Test Attribute </h1>   <p> {{ listing.properties.test }} </p> {% endunless %}

Without the conditional 'unless' statement, if the attribute was blank all that would be displayed would be the content inside the <h1> HTML tag.