lower
Converts a string value to lowercase. This is useful for case-insensitive comparisons when combined with other operators like==, startsWith, endsWith, or in.
Syntax:
- Returns
nullif the input isnull - Returns an empty string if the input is an empty string
- Returns the original value unchanged if the input is not a string (e.g., a number)
- Case-insensitive string matching in calculated attribute formulas
- Normalizing attribute values before comparison
- Building case-insensitive mapping rules with
if/inchains
startsWith
Tests whether a string starts with a given prefix. Both arguments must be strings. Syntax:lower:
- Returns
falseif either argument is not a string - The comparison is case-sensitive by default — use
lowerfor case-insensitive matching
- Categorizing products by SKU prefix
- Matching tag patterns for calculated attribute derivation
- Filtering products by attribute value prefixes
endsWith
Tests whether a string ends with a given suffix. Both arguments must be strings. Syntax:lower:
- Returns
falseif either argument is not a string - The comparison is case-sensitive by default — use
lowerfor case-insensitive matching
- Identifying bundled or grouped products by naming convention
- Matching attribute values that follow a suffix pattern
- Building calculated attributes based on string endings
count
Returns the count of elements in an array. Syntax:- Returns
nullif the input isnullor empty string - Returns the length of the array if valid
- Counting the number of variants in a product
- Calculating the number of images
- Determining the number of options available
parseDate
Parses a date string or timestamp and returns a Unix timestamp (seconds since epoch). Syntax:- String: ISO 8601 date strings, dot-separated dates (e.g., “7.26.2024”), or any format parsable by PHP’s Carbon library
- Numeric: Unix timestamps in seconds or milliseconds (automatically normalized)
null if the input is invalid or unparseable
Examples:
Parse an ISO date string:
parseDate operator supports dot-separated date formats (e.g., “7.26.2024”) with automatic disambiguation:
- Unambiguous D.M.Y: If the first number is greater than 12, it’s interpreted as day (e.g., “26.7.2024” → July 26, 2024)
- Unambiguous M.D.Y: If the second number is greater than 12, it’s interpreted as day (e.g., “7.26.2024” → July 26, 2024)
- Ambiguous dates: When both numbers are ≤ 12 (e.g., “7.6.2024”), the format defaults to M.D.Y (US convention) → July 6, 2024
- Returns
nullif input isnullor empty string - Returns
nullfor unparseable date strings (e.g., “not-a-date”) instead of throwing an exception - Automatically converts millisecond timestamps (> 10 digits) to seconds
- Handles both numeric timestamps and string dates
- Supports zero-padded dot-separated formats (e.g., “07.26.2024”)
daysSince
Calculates the number of days between a given date and the current date. Syntax:- String: Date strings (ISO 8601, dot-separated formats like “7.26.2024”, or any format parsable by PHP’s Carbon)
- Numeric: Unix timestamps in seconds or milliseconds
- JSONLogic expression: Output from
parseDateor other date operations
null if the input is invalid or unparseable
Examples:
Calculate days since publication:
parseDate, the daysSince operator supports dot-separated date formats with automatic disambiguation:
- Unambiguous D.M.Y: “26.7.2024” → July 26, 2024
- Unambiguous M.D.Y: “7.26.2024” → July 26, 2024
- Ambiguous dates: “7.6.2024” defaults to M.D.Y (US convention) → July 6, 2024
- Returns
nullif input isnullor empty string - Returns
nullfor unparseable date strings (e.g., “not-a-date”) instead of throwing an exception - Automatically converts millisecond timestamps to seconds
- Returns absolute value (always positive number of days)
- Product age calculations
- Time-based merchandising rules
- Freshness indicators for new products
- Age-based product filtering
now
Returns the current Unix timestamp in seconds. Syntax:- Real-time date comparisons
- Calculating time differences
- Dynamic time-based rules