Skip to content
otter-page-builder-blocks-extensions

Why start from scratch? Otter Pro gives you 40+ ready patterns, premium blocks, and priority support.

See Pro Plans →

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 PanelUsing 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