VersaCommerce provides more filters than the ones described in the other filter articles. This page lists them by topic. Examples show the filter call and what it returns.
Liquid standard filters
h
Alias of the escape filter. Escapes HTML.
Example: {{ '<b>' | h }} returns <b>.
escape_once
Escapes HTML while preserving existing entities.
Example: {{ '&<' | escape_once }} returns &<.
url_decode
Decodes URL-form encoding.
Example: {{ 'a+b' | url_decode }} returns a b.
sort_natural
Sorts case-insensitively.
Parameters: optional property.
Example: {{ names | sort_natural }} returns the sorted array.
reject
Excludes elements matching a property test.
Parameters: property, optional target.
Example: {{ products | reject: 'available', false }} returns the filtered array.
has
Tests whether an element matches a property test.
Parameters: property, optional target.
Example: {{ products | has: 'available', true }} returns true or false.
find
Returns the first matching element.
Parameters: property, optional target.
Example: {{ products | find: 'handle', 'coat' }} returns the matching product or nil.
find_index
Returns the zero-based index of the first matching element.
Parameters: property, optional target.
Example: {{ products | find_index: 'handle', 'coat' }} returns the index or nil.
compact
Removes nil elements or elements with a nil property.
Parameters: optional property.
Example: {{ products | compact: 'featured_image' }} returns the filtered array.
replace_last
Replaces the last occurrence.
Parameters: substring, replacement.
Example: {{ 'ana' | replace_last: 'a', 'o' }} returns ano.
remove_last
Removes the last occurrence.
Parameters: substring.
Example: {{ 'ana' | remove_last: 'a' }} returns an.
sum
Sums values or numeric properties.
Parameters: optional property.
Example: {{ cart.items | sum: 'quantity' }} returns the total quantity.
Array filters
delete
Subtracts values from flattened input.
Parameters: values.
Example: {{ [1,2,3] | delete: [2] }} returns [1,3].
intersect
Returns common distinct values.
Parameters: other array.
Example: {{ [1,2] | intersect: [2,3] }} returns [2].
sort_bool
Sorts booleans with true before false.
Parameters: optional property.
Example: {{ [false,true] | sort_bool }} returns [true,false].
String filters
encode_url
Encodes input for URL use.
Example: {{ 'a b' | encode_url }} returns the URL-encoded string.
clean_text
Strips tags, normalizes whitespace and encodes entities.
Example: {{ '<b>A</b>' | clean_text }} returns A.
numbers_only
Removes non-digit characters.
Example: {{ 'AB12' | numbers_only }} returns 12.
blake3
Computes a BLAKE3 hexadecimal digest.
Example: {{ 'abc' | blake3 }} returns the hex digest.
encodeurlsafebase64
Encodes URL-safe Base64.
Example: {{ 'abc' | encode_urlsafe_base64 }} returns YWJj.
decodeurlsafebase64
Decodes URL-safe Base64.
Example: {{ 'YWJj' | decode_urlsafe_base64 }} returns abc.
parenthesize
Wraps input in parentheses.
Example: {{ 'A' | parenthesize }} returns (A).
chars
Returns an inclusive substring.
Parameters: first, last.
Example: {{ 'abcd' | chars: 1, 2 }} returns bc.
convert_umlauts
Transliterates umlauts.
Example: {{ 'Köln' | convert_umlauts }} returns Koeln.
words
Splits text on whitespace.
Example: {{ 'a b' | words }} returns [a,b].
to_sentence
Joins an array as a localized sentence list.
Example: {{ names | to_sentence }} returns the localized list.
strip_emptylines
Removes the empty-line patterns recognized by the filter.
Example: {{ multiline_text | strip_emptylines }} returns the text without matching blank lines.
ensure
Uses the fallback when input is blank.
Parameters: fallback.
Example: {{ '' | ensure: 'N/A' }} returns N/A.
fillupto
Right-pads a string to the given length.
Parameters: size, character=' '.
Example: {{ 'a' | fill_up_to: 3, '.' }} returns a...
camelize
Alias for camelcase.
Example: {{ 'hello_world' | camelize }} returns HelloWorld.
htmltoplain_text
Converts HTML to readable plain text.
Example: {{ '<b>A</b>' | html_to_plain_text }} returns A.
titleize
Converts input to title case.
Example: {{ 'hello world' | titleize }} returns Hello World.
Math and color filters
colortooklch
Formats a color in OKLCH.
Example: {{ '#fff' | color_to_oklch }} returns an oklch(...) string.
force_decimals
Formats a fixed number of decimal places.
Parameters: decimal_places=2.
Example: {{ 2 | force_decimals: 3 }} returns 2.000.
to_i
Converts to integer.
Example: {{ 2.9 | to_i }} returns 2.
to_f
Converts to float.
Example: {{ '2.5' | to_f }} returns 2.5.
hextorgb
Converts hex to RGB components.
Parameters: delimiter defaults to comma and space.
Example: {{ '#ff0000' | hex_to_rgb }} returns 255, 0, 0.
rgbtohex
Converts RGB components to hex.
Example: {{ rgb | rgb_to_hex }} returns the hex color.
darken
Darkens a hex color.
Parameters: amount=0.3333.
Example: {{ '#808080' | darken: 0.2 }} returns the darker hex color.
lighten
Lightens a hex color.
Parameters: amount=0.3333.
Example: {{ '#808080' | lighten: 0.2 }} returns the lighter hex color.
contrast_color
Chooses a contrasting color.
Parameters: amount=0.5.
Example: {{ '#000000' | contrast_color }} returns the contrasting color.
Money and price filters
priceforquantity
Returns the applicable product price for a quantity.
Parameters: quantity.
Example: {{ product | price_for_quantity: 10 }} returns the applicable unit price.
formatted_money
Formats an amount with formatting options.
Parameters: optional formatting arguments.
Example: {{ product.price | formatted_money }} returns the formatted amount.
moneywithcurrency_code
Formats money with the currency code.
Example: {{ product.price | money_with_currency_code }} returns the amount with ISO currency code.
money_amount
Extracts the numeric amount.
Example: {{ product.price | money_amount }} returns the numeric amount.
unitpricewith_measurement
Formats a unit price and reference measurement.
Parameters: optional unitpricemeasurement.
Example: {{ product.unit_price | unit_price_with_measurement: product.unit_price_measurement }} returns the localized amount per reference unit.
Date filters
calculate_date
Adds or subtracts a date interval.
Parameters: amount, add/subtract, days/weeks/months/years.
Example: {{ a_date | calculate_date: 1, 'add', 'days' }} returns the next date.
Cart filters
itemcountfor_variant
Sums quantities of cart positions matching a variant ID.
Parameters: variant ID.
Example: {{ cart | item_count_for_variant: 42 }} returns the matching quantity.
lineitemsfor
Filters cart positions for a product or variant object.
Parameters: product or variant.
Example: {{ cart | line_items_for: product }} returns the matching line items.
HTML and form filters
unbrandedbuttonhtml
Builds the buy-now wrapper and button.
Parameters: product FormDrop as input.
Example: {{ form | unbranded_button_html }} returns a div.shopify-payment-button with a buy button.
avatar
Renders an avatar for the input.
Example: {{ user | avatar }} returns the avatar markup.
baseerrormessages
Renders base-level validation errors.
Parameters: HTML options.
Example: {{ object | base_error_messages }} returns the error markup.
error_messages
Renders validation errors for an object.
Parameters: HTML options.
Example: {{ object | error_messages }} returns the error markup.
inlineassetcontent
Reads content of a theme asset for inline use.
Parameters: asset name as input.
Example: {{ 'theme.css' | inline_asset_content }} returns the content of theme.css.
errormessageson
Renders validation errors for a single field.
Parameters: field, optional HTML options.
Example: {{ object | error_messages_on: 'email' }} returns the email error markup.
property_table
Renders product properties as a table.
Parameters: optional class and id.
Example: {{ product.properties | property_table: 'specs' }} returns a <table class="specs">.
formattedpropertytable
Alias for property_table.
Parameters: optional class and id.
Example: {{ product.properties | formatted_property_table }} returns the property table HTML.
structured_data
Generates JSON-LD for supported product and article drops.
Example: {{ product | structured_data }} returns the product as JSON-LD.
Link filters
linktocart
Builds a cart link or add-to-cart link for a product.
Parameters: product, title text, class, id.
Example: {{ 'Buy' | link_to_cart: product }} returns the cart action anchor.
linktoaddtolist
Builds a link to add a product to a storefront list.
Parameters: list, product ID, title, class, id.
Example: {{ 'Save' | link_to_add_to_list: list, product.id }} returns the add-to-list anchor.
linktoremovefromlist
Builds a link to remove a product from a storefront list.
Parameters: list, product ID, title, class, id.
Example: {{ 'Remove' | link_to_remove_from_list: list, product.id }} returns the remove-from-list anchor.
linktocategory
Alias for linktotype.
Parameters: optional link options.
Example: {{ category | link_to_category }} returns the category anchor.
Navigation filters
navigation
Renders nested menu HTML.
Parameters: id, CSS class.
Example: {{ linklists.main | navigation }} returns the nested menu markup.
flat_navigation
Renders a flat menu.
Parameters: id, CSS class.
Example: {{ linklists.main | flat_navigation }} returns the flat menu markup.
nav_tree
Renders a tree of links.
Parameters: rendering options.
Example: {{ menu.links | nav_tree }} returns the nested list.
nav_list
Renders a list of links.
Parameters: rendering options.
Example: {{ menu.links | nav_list }} returns the list markup.
tree_item
Renders a link and child tree.
Parameters: rendering options.
Example: {{ link | tree_item }} returns the nested list item.
nav_item
Renders one menu item.
Parameters: rendering options.
Example: {{ link | nav_item }} returns the menu item markup.
linktolink_type
Builds an anchor from a link object.
Parameters: optional anchor class.
Example: {{ link | link_to_link_type: 'menu-link' }} returns a link with the menu-link class.
Tag filters
linktotags
Builds a link filtered by multiple tags.
Parameters: tags, optional title.
Example: {{ 'New' | link_to_tags: tags }} returns the tag-filter anchor.
most_used
Selects the most-used tags.
Parameters: size.
Example: {{ tags | most_used: 5 }} returns up to five tags.
most_important
Alias for most_used.
Parameters: size.
Example: {{ tags | most_important: 5 }} returns up to five tags.
tag_list
Renders a list of tag links.
Parameters: id='tag_list'.
Example: {{ tags | tag_list }} returns the tag list markup.
tag_cloud
Renders a tag cloud.
Parameters: weight class and cloud ID.
Example: {{ tags | tag_cloud }} returns the weighted tag cloud markup.
weight_tags
Assigns weights to tags by use count.
Parameters: steps=5.
Example: {{ tags | weight_tags: 5 }} returns the weighted tags.
weightedtagitem
Renders a weighted tag item.
Parameters: weight class.
Example: {{ weighted_tag | weighted_tag_item }} returns the weighted item markup.
tag_item
Renders a single tag item.
Example: {{ tag | tag_item }} returns the tag item markup.
Translation filters
translate
Long form of t; resolves and interpolates translations.
Parameters: optional interpolation hash.
Example: {{ 'greeting' | translate: name: 'Ada' }} returns the localized greeting.
Font filters
fontproxyurl
Builds the configured font proxy origin or its family CSS URL.
Parameters: family as input; blank for origin.
Example: {{ 'Open+Sans:300,600' | font_proxy_url }} returns https://fonts.versacommerce.io/css?family=Open+Sans:300,600.
Weight filters
weight
Formats a numeric weight without a unit.
Example: {{ product.weight | weight }} returns the formatted weight.