For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom Liquid filters

Filters are simple methods that modify the output of numbers, strings, variables, and objects. They are placed within an output tag {{ }} and are denoted by a pipe character |. In addition to the standard filters, Stockeo also provides custom filters.

base64_encode

Encodes the provided input into Base64 format. If the input is binary data, it is directly converted into a Base64 string; otherwise, the input is first converted into a UTF-8 byte representation before encoding.

{{ "Hello World!" | base64_encode }}

base64_decode

Decodes a Base64-encoded string back into its original form. The decoded binary data is then interpreted as UTF-8 text and returned as a readable string.

{{ "SGVsbG8gV29ybGQh" | base64_decode }}

ensure_array

Ensures that the value is always returned as an array. If the input value is null or undefined, an empty array is returned. If the value is already an array, it is returned unchanged. Otherwise, the value is wrapped in a single-element array.

Assume that the node attributes may contain either one or more child nodes.

When parsing a node with a single child node, the result is a single object:

<attributes>
    <attribute>
        <name>Color</name>
        <value>Black</value>
    </attribute>
</attributes>

When parsing a node with multiple child nodes, the result is an array of objects:

The ensure_array filter removes this ambiguity by ensuring a consistent array structure, making the Liquid formulas shorter and easier to maintain.

gzip

Compresses the provided input using the GZIP compression algorithm with a high compression level. It outputs the result as compressed binary data, which can optionally be encoded in Base64 using the base64_encode custom Liquid filter.

json_parse, parse_json

Allows parsing string in a format compliant with JSON file requirements into an object. It enables access to individual fields within the object using dot or bracket notation.

Usage example: Assume that individual product nodes don't contain category names, but only a category_id.

If you want to add categories as tags, you can create a formula that creates an object with key-value pairs, so-called dictionary variable. In this case, keys are categories ids, and values - their names. With the formula below, the category name will be found by its ID:

moment

Returns a current or specified time converted to a desired time zone.

The filter has two parameters: a date format and a time zone identifier.

format
description
example value

DD

Two-digit day of the month (with leading zeros)

01 to 31

MM

Two-digit representation of the month

01 to 12

YY

Two-digit representation of the year

26

YYYY

Four-digit representation for the year

2026

HH

Two-digit representation of the hour in 24-hour format

00 to 23

hh

Two-digit representation of the hour in 12-hour format

01 to 12

A

Upper-case 'AM' or 'PM' based on the given time

AM or PM

a

Lower-case 'am' or 'pm' based on the given time

am or pm

mm

Two-digit representation of the minute

00 to 59

ss

Two-digit representation of the second

00 to 59

This filter can be used, for example, in the File Path field of an FTP channel to match files whose names contain date or time information, allowing the automation to process only feeds generated on the current day or during the current hour.

to_fixed

Rounds the number to keep only the given number of decimals.

The difference between round and to_fixed it that round returns a number so it trims trailing zeros while to_fixed will preserve them.

xml_unescape

Unescaping characters that are treated as special in XML documents:

Escaped String

Char

&lt;

<

&gt;

>

&quot;

"

&apos;

'

&amp;

&

This is useful when special characters from HTML in the product description coming from the feed are escaped, causing the HTML syntax to be incorrectly interpreted by Shopify.

xml_escape

It works in the opposite way to the xml_unescape filter. It replaces characters that are considered special in XML documents.

Char

Escape String

<

&lt;

>

&gt;

"

&quot;

'

&apos;

&

&amp;

Last updated