How to Display Blocks Based on Cookies?
π Note: This is part of the Otter PRO features library, which you can get from here.
| Enabling the Panel | Using the Condition | 
| Example | |
π² Enabling the Panel
Blocks visibility can be controlled using the Visibility Conditions that Otter brings in. These can be found under Block Tools, and clicking on them to create a separate panel.
After enabling the panel, open it to insert conditions. This article will present an example of Cookie-based visibility conditions:
This condition is based on the PHP cookies. These cookies are small fragments of data stored on a client browser, which makes the user recognizable.
π§° Using the Condition
Using this condition, the website will recognize the user using the cookies and display / not display the blocks anymore.
- 1
- 
  First, pick the Cookie condition from the dropdown. 
- 2
- 
  Insert the cookie's key in the field. This is equal to the cookie's name. 
- 3
- 
  Pick the compare operator. It can be is True/False/Empty or if Equals/Contains. 
π Note: Based on the operator, other fields may appear.
- 4
- 
  Select the block's behavior if the condition is met (Visible/Hidden). 
π‘Example
In the example below, we have created a cookie named user and inserted it in otter-blocks.php, then we have added the key inside the field.
π‘Result
When the condition is met
When the condition is not met
 
                
            
            



