Skip to main content

Using Variables

Variables in Prodyflow allow you to make your blocks and content context-aware instead of relying on static values. They can be used in two main scenarios:

  1. Filtering Products: Variables enable you to dynamically filter product lists based on the current page or product context. For example, you can display products that belong to the same category as the viewed product, or show items with a higher price than the current product. This allows you to create more relevant product suggestions, personalized listings, and smarter recommendations automatically.

  2. Setting Up Visibility Rules: Variables can also control whether a block is shown or hidden depending on the page context or product data. For instance, you can hide a promotional banner for out-of-stock products, display content only for specific brands, or create more complex rules combining multiple conditions. This ensures that your webshop shows only the content that is relevant to each customer, improving usability and reducing clutter.

Using variables for filtering products

Variables allow you to use dynamic, page-based data instead of fixed values. This means that instead of entering a static value for a block (like a specific product-details or text), the block can use data that is relevant to the current page or context.


Examples

  • Show products with a price greater than the viewed product.
  • Show products from the same category as the viewed product.

How to Use Variables for Filtering Products

  1. Open the block editor on the dynamic page where you want to apply a filter.
  2. Select the block that supports variable-based content (e.g., product lists, featured products).
  3. In the block settings, locate the filter variable or data option Select variable.
  4. Choose a variable from the available options, such as product.price or product.category_id.
  5. Save the block. The filtered content will now dynamically adjust based on the current page's data.

Setting up visibility rules


Examples

  • Hide a block if the current product is out of stock.
  • Display promotional content only for products that belong to specific brands.

Comparison Operators

Prodyflow supports several comparison operators to define conditions for variables:

  • > : Greater than
  • < : Less than
  • == : Equal to
  • <= : Less than or equal to
  • >= : Greater than or equal to
  • in : Checks if a value exists in a list
  • not in : Checks if a value does not exist in a list

These operators are used in visibility rules or when setting dynamic content to ensure blocks only display when specific criteria are met.


AND and OR Logic

  • AND: All conditions within the AND block must be true for the rule to pass.
    Example: Show a block only if the product is in category "Shoes" AND the price is greater than $50.

  • OR: Only one of the conditions within the OR block needs to be true for the rule to pass.
    Example: Show a block if the product is in category "Shoes" OR the product is on sale.

Using AND and OR, combined with nested conditions, gives you full control over when and how the block is displayed in your webshop.


Nested Conditions

Nested conditions allow you to combine multiple rules in a hierarchical structure. For example, you can create a block that is visible only if:

  • The product category is "Shoes" AND the stock is greater than 0
  • OR the product is on sale

By nesting conditions, you can create complex visibility rules that accurately reflect your business logic and automate which blocks are displayed.