Skip to main content
Layers uses JSONLogic for creating calculated attributes with dynamic values. A JSONLogic rule is structured as follows: { "operator" : ["values" ... ] }. For example, { "cat" : ["I love", " ", "pie"] } results in “I love pie”.

Overview

JSONLogic provides a powerful way to transform and validate product data within calculated attributes. The platform supports both standard JSONLogic operators and custom extensions designed specifically for e-commerce use cases.

Data access patterns

When writing JSONLogic formulas in Layers, you have access to two types of data:

Catalog attributes

Reference existing catalog attributes using the _attribute: prefix followed by the attribute code:
{
  "var": "_attribute:price_range.from"
}
Use dot notation to access nested properties:
{
  "var": "_attribute:metafields.custom.material"
}

Raw Shopify data

Access raw underlying Shopify data before transformation using the _raw:raw. prefix:
{
  "var": "_raw:raw.variants"
}
Common raw data paths include:
  • _raw:raw.variants - Array of product variants
  • _raw:raw.featured_media - Featured image data
  • _raw:raw.images - Array of product images
  • _raw:raw.options - Product options
Use dot notation to access nested properties in raw data:
{
  "var": "_raw:raw.variants.0.created_at"
}

See also