Filters

Filters manipulate the output of variables. Filters look like this {{ variablename | filtername }}. For example:

{{ product.name | upcase }}
YOUR PRODUCT NAME

HTML Filters

URL Filters

Money Filters

  • money_with_currency Takes a number and wraps in the currency symbol and descriptor
  • money_without_currency Formats the number, but displays no currency symbol or descriptor
  • money Converts a number into a string based on your currency

Math Filters

  • plus Adding input to operand plus: 10
  • minus Subtracting input from operand minus: 10
  • times Multiplying input by operand times: 10
  • divided_by Dividing input by operand divided_by: 10

Manipulation Filters

  • append Append characters to a string
  • camelize Converts into CamelCase, strips spaces and irregular characters
  • capitalize Capitalizes a string
  • date Reformat a date
  • default_pagination Use with the paginate liquid tag to create pagination
  • downcase Converts a string into lowercase
  • escape Escapes a string
  • first Get the first element of the passed in array
  • handleize Non-word characters are stripped out and characters are lowercased
  • highlight_active_tag Creats a span with the class “active”
  • join Joins an array with a specified character join: ‘, ‘
  • last Get the last element in an array
  • replace_first Replace the first occurrence of a string with another
  • remove Removes all occurrences of the substring from the input remove: ‘red’
  • remove_first Removes only the first occurrence of the substring from the input remove_first: ‘red’
  • newline_to_br Inserts a
    tag in front of every \n linebreak character.
  • pluralize Can make a word plural pluralize: ‘item’, ‘items’
  • prepend Append characters to a string
  • size Return the size of an array or string
  • split Divides a string into substrings based on a delimiter, returning an array of these substrings
  • strip_html Striple all html tags from string
  • strip_newlines Removes all newlines from the input
  • replace Will replace all occurrences of a string with another
  • truncate Truncate a string down to x characters
  • truncatewords Truncate string down to x words
  • upcase Convert a input string to uppercase
  • weight_with_unit Converts a weight into the unit system of the shop
  • json Converts some content into a JSON string