How To Use Rendering Logic in Avada

Last Update: May 7, 2024

Rendering Logic in Avada gives you the ability to decide what elements on your page are rendered, according to conditional logic statements you add to columns and containers. In this document, we will look at how it works, and some of the ways in which it can be used. Read on to find out more about this exciting feature, and watch the video below for a visual overview.

For privacy reasons YouTube needs your permission to be loaded.

What is Rendering Logic?

Rendering Logic, or Conditional Element Rendering, is a form of conditional logic that can determine whether an Element (in this case, the Column or the Container Element, but is also applies for all content within that Column or Container) should be rendered on the page or not. A few simple examples of this would be a Column that only displays if a user is logged in, a Header container that only renders if the user is on a small screen, or a Container on a Cart page that does not render if the Cart is empty. There can also be multiple conditions applied for complex situations. There is a significant difference in the amount of code loaded onto the page between not rendering an Element and simply hiding it on the page with the Element Visibility option.

Where Is It Found?

Conditional Element Rendering is currently found in the Column and the Container Elements, under the Extras tab. Because these Elements hold all content on the page however, this allows for almost all imaginable usage scenarios.

How To Use Rendering Logic

There will be an enormously wide variety of situations were this feature could be used. The best we can offer here is a breakdown of the possible values, and a few scenarios to give you the idea.

As you can see in the screenshot below, when you click on the + Add New Logic Button, you are presented with a Condition Type option, a Relational Operator selector (Equal To, Not Equal To, and in some instances, also Greater Than, Less Than, and Contains), and a Condition Value field. Below this is an AND/OR option which you can to combine further Logic Terms.

Container / Column > Extras > Rendering Logic

Examples Of Conditional Element Rendering

Mobile Header

One example of using rendering logic is the situation where you want a different header (or part of the header) when your users are on mobile. In this case, you could just build your header as usual for desktop, and apply rendering logic to the holding container that only allows that container to render when the screen size equals desktop, as per the left image below.

Then you could create another container with the mobile header contents, and again set rendering logic on that, but this time, only to render when the screen is equal to mobile, as per the image below on the right. You could also make a third container for tablet, or add (or subtract) it to one of the other conditional statements.

Rendering Logic > Example

Cart Page

Another example of how to use Conditional Element Rendering is when building a custom Cart Page for WooCommerce. When a Cart is empty, for example, you would not want all the usual Cart Elements to display, and so by using Conditional Element rendering on the various Columns and Containers on the page, we could achieve that scenario easily. See the Avada WooCommerce Builder – Cart page for specific details of how to achieve this. Another example can be found in the video at the top of the page.

There are many more scenarios where this feature would be useful, including rendering content based on whether a user is logged in, or what their role is, whether an Event or Sale has started or finished, and whether the content is being viewed on a mobile or tablet, or even on a specific browser, just to name a few examples. This much requested feature brings an incredible level of flexibility to your page content, and is just another example of the innovation we continually bring to the table for Avada users!

Condition Types & Values

In the list below, you can see all the available Conditions Types. There is a variance of Relational Operators as well as Condition Values. As you can imagine, there are a huge number of possible scenarios, where this much requested feature could be used to control the Container or Column contents. The way to think of it is “I want to render this container if…”

  • Device Type – Possibly the most basic of all conditional rendering, this allows you to set whether the content renders or not on a particular device type (size). The relational operators are Equal To and Not Equal To, and the possible values are Desktop, Mobile & Tablet, Tablet and Mobile.

  • GET Variable – This lets you check for a custom variable and value defined in the URL’s query string. It can particularly be useful when redirecting visitors after a form submission or similar. The relational operators are Equal To, Not Equal To, Greater Than, Less Than and Contains.
  • SESSION Variable – This lets you check for a custom variable and value stored server-side and linked to the session. The relational operators are Equal To, Not Equal To, Greater Than, Less Than and Contains.
  • User Agent – The User Agent is a short, technical description of the web browser, operating system, (and maybe mobile device) that you’re using as you access the internet. The relational operators are Equal To, Not Equal To, Greater Than, Less Than and Contains, and the Condition value will be the user agent you want to check for.
  • Referrer – The referrer is the webpage that sends visitors to your site using a link. In other words, it’s the webpage that a person was on right before they landed on your page. The relational operators are Equal To, Not Equal To, and Contains, and the Condition Value is the Referrer URL.

  • User Role – This is the WordPress User Role. The relational operators are Equal, and Not Equal To, and the Condition Values are whatever user roles you have registered on your website, such as Administrator, Editor, Author, Contributor etc.
  • User State – This refers to whether the user is logged in or not. The relational operators are Equal To and Not Equal To, and the Condition Values are Logged In, and Logged Out

  • Custom Field – Check the value of a WP custom field variable. The relational operators are Equal To, Not Equal To, Greater Than, Less Than and Contains.
  • Post Category – This can be used for the Post Category. The relational operators are Equal To and Not Equal To, and the Condition Values will be a list of Post Categories on your site. 

  • Post Tag – This can be used for your post tags. The relational operators are Equal To and Not Equal To, and the Condition Values will be a list of the post tags on your site. 

  • Post Term – This can be used for your post terms. The relational operators are Equal To and Not Equal To, and the Condition Value is a Term ID. 

  • Post Count – This can be used to check whether an archive page has more or less posts than specified by you. The relational operators are Equal To, Not Equal To, Greater Than and Less Than, and the Condition Value is a number.
  • Term Count – This can be used to check against the total number of terms on a taxonomy archive. The relational operators are Equal To, Not Equal To, Greater Than and Less Than, and the Condition Value is a number.
  • Term ID – This can be used for your Term ID. The relational operators are Equal To and Not Equal To, and the Condition Value is a Term ID.

  • Comment Status – This can be used for the status of a comment. The relational operators are Equal To and Not Equal To, and the Condition Values are Open or Closed.

  • Comments Count – This can be used to check against the number of comments related to a given post. The relational operators are Equal To, Not Equal To, Greater Than and Less Than, and the Condition Value is a number.
  • Number Of Headings – This can be used to check against the number of headings used on a given post. This is particularly useful, if you want to display a Tabel of Contents element conditionally. The relational operators are Equal To, Not Equal To, Greater Than and Less Than, and the Condition Value is a number.
  • Cart Status – This can be used based on the status of the Cart. The relational operators are Equal To and Not Equal To, and the Condition Values are In or Empty. 

  • Sale Status – Similarly, this can be used based on the Sale status. The relational operators are Equal To and Not Equal To, and the Condition Values are Started or Ended.

  • Stock Quantity – This can be used based on the stock quantity of a product. The relational operators are Equal To, Not Equal To, Greater Than and Less Than, and the Condition Value is simply a number.
  • Stock Status – This can be used based on the status of stock. The relational operators are Equal To and Not Equal To, and the Condition Values are In Stock or Out Of Stock.

  • Product Purchase Status – This can be used based on the purchase status of a product. You can add a specific ID for a product, or you can leave the field empty to use the current product. The relational operators are Equal To and Not Equal To, and the Condition Values are Purchased or Not Purchased. 

  • Product Type – This can be used based on the type of the product. The relational operators are Equal To and Not Equal To, and the Condition Values are Simple Product, Grouped Product, External/Affiliate Product or Variable Product.  

  • Product Category – This can be used for the Product Categories. The relational operators are Equal To and Not Equal To, and the Condition Values will be a list of Product Categories on your site. 

  • Product Tag – This can be used for your product tags. The relational operators are Equal To and Not Equal To, and the Condition Values will be a list of the product tags on your site. 
  • Related Products – This can be used for your related products. The relational operators are Equal To, Not Equal To Greater Than and Less Than, and the Condition Value is a number.
  • Up-Sells Products – This can be used for your Up-Sells products. The relational operators are Equal To, Not Equal To Greater Than and Less Than, and the Condition Value is a number.
  • Cross-Sells Products – This can be used for your Cross-Sells products. The relational operators are Equal To, Not Equal To Greater Than and Less Than, and the Condition Value is a number.
  • Product Variations – This can be used for your Product Variations. The relational operators are Has and Has Not, and the Condition Value is the Attrbute name eg. color or size.

  • Order Received Status – This can be used for the Status of the received order. The relational operators are Equal To and Not Equal To, and the Condition Values are Pending Payment, Processing, On Hold, Completed, Cancelled, Refunded, Failed, or Draft. 

  • Order Received Total Value – This can be used for the total value of your recieved order. The relational operators are Equal To, Not Equal To Greater Than and Less Than, and the Condition Value is the total value of the order. Note. This only works on the Order Received Page (after user checks out). 

  • Order Received Download Count – This can be used for the total number of items in your recieved order. The relational operators are Equal To, Not Equal To Greater Than and Less Than, and the Condition Value is the number of items that can be downloaded on the order receieved page. Note. This only works on the Order Received Page (after user checks out). 

  • Event Status – This can be used based on the status of your event. The relational operators are Equal To and Not Equal To, and the Condition Values are Started or Ended

  • ACF Field – This can be used for your ACF Fields. There is a Field Name field, and the relational operators are Equal To, Not Equal To Greater Than, Less Than and Contains. The Condition Value is needs to match the type of the field.
  • ACF Repeater Count – This can be used to check against the number of rows available for a single repeater field. There is a Field Name field, and the relational operators are Equal To, Not Equal To Greater Than, Less Than and Contains. The Condition Value is is a number.
  • ACF Repeater Single Value – This can be used for your ACF Repeater Single Values. There is a field for the field name and value – field[1][name], and the relational operators are Equal To, Not Equal To Greater Than, Less Than and Contains. The Condition Value needs to match the type of the repeater sub field.
  • ACF Repeater Sub Field – This can be used for your ACF Repeater Sub Field. There is a Sub Field Name field, and the relational operators are Equal To, Not Equal To Greater Than, Less Than and Contains. The Condition Value needs to match the type of the repeater sub field.
  • ACF Relationship Count – This can be used to check against the number of available ACF Relationships. There is a Field Name field, and the relational operators are Equal To, Not Equal To Greater Than, Less Than and Contains. The Condition Value is a number.

In this article