Liquid filters Liquid filters are used to modify Liquid output. ## Filters Liquid filters are used to modify Liquid output. ### Filters with parameters Many filters accept parameters that let you specify how the filter should be applied. Some filters might require parameters to be valid. ### Using multiple filters Multiple filters can be used on one output. They're applied from left to right. ### Usage To apply filters to an output, add the filter and any filter parameters within the output's curly brace delimiters `{{ }}`, preceded by a pipe character `|`. In the example below, `product` is the object, `title` is its property, and `upcase` is the filter being applied. ## Array filters Array filters modify [arrays](/docs/api/liquid/basics#array). ### compact Deprecated: false array | compact Removes any `nil` items from an array. #### Examples code: {%- assign original_prices = collection.products | map: 'compare_at_price' -%} Original prices: {% for price in original_prices -%} - {{ price }} {%- endfor %} {%- assign compacted_original_prices = original_prices | compact -%} Original prices - compacted: {% for price in compacted_original_prices -%} - {{ price }} {%- endfor %} data: {"collection":{"products":[{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":"1000000.59"},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":"10.00"},{"compare_at_price":null},{"compare_at_price":"25.00"},{"compare_at_price":"400.00"},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":null},{"compare_at_price":null}]}} output: Original prices: - - - - - 100000059 - - - - 1000 - - 2500 - 40000 - - - - - - - Original prices - compacted: - 100000059 - 1000 - 2500 - 40000 ### concat Deprecated: false array | concat: array Concatenates (combines) two arrays. #### Examples code: {%- assign types_and_vendors = collection.all_types | concat: collection.all_vendors -%} Types and vendors: {% for item in types_and_vendors -%} {%- if item != blank -%} - {{ item }} {%- endif -%} {%- endfor %} data: {"collection":{"all_types":["","Animals & Pet Supplies","Baking Flavors & Extracts","Container","Cooking & Baking Ingredients","Dried Flowers","Fruits & Vegetables","Gift Cards","Health","Health & Beauty","Invisibility","Love","Music & Sound Recordings","Seasonings & Spices","Water"],"all_vendors":["Clover's Apothecary","Polina's Potent Potions","Ted's Apothecary Supply"]}} output: Types and vendors: - Animals & Pet Supplies - Baking Flavors & Extracts - Container - Cooking & Baking Ingredients - Dried Flowers - Fruits & Vegetables - Gift Cards - Health - Health & Beauty - Invisibility - Love - Music & Sound Recordings - Seasonings & Spices - Water - Clover's Apothecary - Polina's Potent Potions - Ted's Apothecary Supply ### first Deprecated: false array | first Returns the first item in an array. #### Examples code: {%- assign first_product = collection.products | first -%} {{ first_product.title }} data: {"collection":{"products":[{"title":"Blue Mountain Flower"},{"title":"Charcoal"},{"title":"Crocodile tears"},{"title":"Dandelion milk"},{"title":"Draught of Immortality"},{"title":"Dried chamomile"},{"title":"Forest mushroom"},{"title":"Gift Card"},{"title":"Glacier ice"},{"title":"Ground mandrake root"},{"title":"Health potion"},{"title":"Invisibility potion"},{"title":"Komodo dragon scale"},{"title":"Love Potion"},{"title":"Mana potion"},{"title":"Potion beats"},{"title":"Potion bottle"},{"title":"Viper venom"},{"title":"Whole bloodroot"}]}} output: Blue Mountain Flower code: {{ collection.products.first.title }} data: {"collection":{"products":[{"title":"Blue Mountain Flower"},{"title":"Charcoal"},{"title":"Crocodile tears"},{"title":"Dandelion milk"},{"title":"Draught of Immortality"},{"title":"Dried chamomile"},{"title":"Forest mushroom"},{"title":"Gift Card"},{"title":"Glacier ice"},{"title":"Ground mandrake root"},{"title":"Health potion"},{"title":"Invisibility potion"},{"title":"Komodo dragon scale"},{"title":"Love Potion"},{"title":"Mana potion"},{"title":"Potion beats"},{"title":"Potion bottle"},{"title":"Viper venom"},{"title":"Whole bloodroot"}]}} output: Blue Mountain Flower ### join Deprecated: false array | join Combines all of the items in an array into a single string, separated by a space. #### Examples code: {{ collection.all_tags | join }} data: {"collection":{"all_tags":["extra-potent","fresh","healing","ingredients"]}} output: extra-potent fresh healing ingredients code: {{ collection.all_tags | join: ', ' }} data: {"collection":{"all_tags":["extra-potent","fresh","healing","ingredients"]}} output: extra-potent, fresh, healing, ingredients ### last Deprecated: false array | last Returns the last item in an array. #### Examples code: {%- assign last_product = collection.products | last -%} {{ last_product.title }} data: {"collection":{"products":[{"title":"Blue Mountain Flower"},{"title":"Charcoal"},{"title":"Crocodile tears"},{"title":"Dandelion milk"},{"title":"Draught of Immortality"},{"title":"Dried chamomile"},{"title":"Forest mushroom"},{"title":"Gift Card"},{"title":"Glacier ice"},{"title":"Ground mandrake root"},{"title":"Health potion"},{"title":"Invisibility potion"},{"title":"Komodo dragon scale"},{"title":"Love Potion"},{"title":"Mana potion"},{"title":"Potion beats"},{"title":"Potion bottle"},{"title":"Viper venom"},{"title":"Whole bloodroot"}]}} output: Whole bloodroot code: {{ collection.products.last.title }} data: {"collection":{"products":[{"title":"Blue Mountain Flower"},{"title":"Charcoal"},{"title":"Crocodile tears"},{"title":"Dandelion milk"},{"title":"Draught of Immortality"},{"title":"Dried chamomile"},{"title":"Forest mushroom"},{"title":"Gift Card"},{"title":"Glacier ice"},{"title":"Ground mandrake root"},{"title":"Health potion"},{"title":"Invisibility potion"},{"title":"Komodo dragon scale"},{"title":"Love Potion"},{"title":"Mana potion"},{"title":"Potion beats"},{"title":"Potion bottle"},{"title":"Viper venom"},{"title":"Whole bloodroot"}]}} output: Whole bloodroot ### map Deprecated: false array | map: string Creates an array of values from a specific property of the items in an array. #### Examples code: {%- assign product_titles = collection.products | map: 'title' -%} {{ product_titles | join: ', ' }} data: {"collection":{"products":[{"title":"Draught of Immortality"},{"title":"Glacier ice"},{"title":"Health potion"},{"title":"Invisibility potion"}]}} output: Draught of Immortality, Glacier ice, Health potion, Invisibility potion ### reverse Deprecated: false array | reverse Reverses the order of the items in an array. #### Examples code: Original order: {{ collection.products | map: 'title' | join: ', ' }} Reverse order: {{ collection.products | reverse | map: 'title' | join: ', ' }} data: {"collection":{"products":[{"title":"Draught of Immortality"},{"title":"Glacier ice"},{"title":"Health potion"},{"title":"Invisibility potion"}]}} output: Original order: Draught of Immortality, Glacier ice, Health potion, Invisibility potion Reverse order: Invisibility potion, Health potion, Glacier ice, Draught of Immortality code: {{ collection.title | split: '' | reverse | join: '' }} data: {"collection":{"title":"Sale potions"}} output: snoitop elaS ### size Deprecated: false variable | size Returns the size of a string or array. #### Examples code: {{ collection.title | size }} {{ collection.products | size }} data: {} output: 12 4 code: {% if collection.products.size >= 10 %} There are 10 or more products in this collection. {% else %} There are less than 10 products in this collection. {% endif %} data: {} output: There are less than 10 products in this collection. ### sort Deprecated: false array | sort Sorts the items in an array in case-sensitive alphabetical, or numerical, order. #### Examples code: {% assign tags = collection.all_tags | sort %} {% for tag in tags -%} {{ tag }} {%- endfor %} data: {"collection":{"all_tags":["Burning","dried","extra-potent","extracts","fresh","healing","ingredients","music","plant","Salty","supplies"]}} output: Burning Salty dried extra-potent extracts fresh healing ingredients music plant supplies code: {% assign products = collection.products | sort: 'price' %} {% for product in products -%} {{ product.title }} {%- endfor %} data: {"collection":{"products":[{"price":"10.00","title":"Blue Mountain Flower"},{"price":"0.00","title":"Charcoal"},{"price":"56.00","title":"Crocodile tears"},{"price":"0.00","title":"Dandelion milk"},{"price":"1000000.00","title":"Draught of Immortality"},{"price":"8.98","title":"Dried chamomile"},{"price":"0.00","title":"Forest mushroom"},{"price":"10.00","title":"Gift Card"},{"price":"0.00","title":"Glacier ice"},{"price":"0.00","title":"Ground mandrake root"},{"price":"10.00","title":"Health potion"},{"price":"250.00","title":"Invisibility potion"},{"price":"0.00","title":"Komodo dragon scale"},{"price":"0.00","title":"Love Potion"},{"price":"10.00","title":"Mana potion"},{"price":"0.00","title":"Potion beats"},{"price":"0.00","title":"Potion bottle"},{"price":"400.00","title":"Viper venom"},{"price":"24.99","title":"Whole bloodroot"}]}} output: Charcoal Dandelion milk Forest mushroom Glacier ice Ground mandrake root Komodo dragon scale Love Potion Potion beats Potion bottle Dried chamomile Blue Mountain Flower Gift Card Health potion Mana potion Whole bloodroot Crocodile tears Invisibility potion Viper venom Draught of Immortality ### sort_natural Deprecated: false array | sort_natural Sorts the items in an array in case-insensitive alphabetical order. #### Examples code: {% assign tags = collection.all_tags | sort_natural %} {% for tag in tags -%} {{ tag }} {%- endfor %} data: {"collection":{"all_tags":["Burning","dried","extra-potent","extracts","fresh","healing","ingredients","music","plant","Salty","supplies"]}} output: Burning dried extra-potent extracts fresh healing ingredients music plant Salty supplies code: {% assign products = collection.products | sort_natural: 'title' %} {% for product in products -%} {{ product.title }} {%- endfor %} data: {"collection":{"products":[{"title":"Blue Mountain Flower"},{"title":"Charcoal"},{"title":"Crocodile tears"},{"title":"Dandelion milk"},{"title":"Draught of Immortality"},{"title":"Dried chamomile"},{"title":"Forest mushroom"},{"title":"Gift Card"},{"title":"Glacier ice"},{"title":"Ground mandrake root"},{"title":"Health potion"},{"title":"Invisibility potion"},{"title":"Komodo dragon scale"},{"title":"Love Potion"},{"title":"Mana potion"},{"title":"Potion beats"},{"title":"Potion bottle"},{"title":"Viper venom"},{"title":"Whole bloodroot"}]}} output: Blue Mountain Flower Charcoal Crocodile tears Dandelion milk Draught of Immortality Dried chamomile Forest mushroom Gift Card Glacier ice Ground mandrake root Health potion Invisibility potion Komodo dragon scale Love Potion Mana potion Potion beats Potion bottle Viper venom Whole bloodroot ### sum Deprecated: false array | sum Returns the sum of all elements in an array. #### Examples code: {% assign fibonacci = '0, 1, 1, 2, 3, 5' | split: ', ' %} {{ fibonacci | sum }} data: {} output: 12 code: Total quantity of all items in cart: {{ cart.items | sum: 'quantity' }} Subtotal price for all items in cart: {{ cart.items | sum: 'final_line_price' | money }} data: {"cart":{"items":[{"final_line_price":"22.49","quantity":1},{"final_line_price":"400.00","quantity":1}]}} output: Total quantity of all items in cart: 2 Subtotal price for all items in cart: $422.49 ### uniq Deprecated: false array | uniq Removes any duplicate items in an array. #### Examples code: {% assign potion_array = 'invisibility, health, love, health, invisibility' | split: ', ' %} {{ potion_array | uniq | join: ', ' }} data: {} output: invisibility, health, love ### where Deprecated: false array | where: string, string Filters an array to include only items with a specific property value. #### Examples code: {% assign polina_products = collection.products | where: 'vendor', "Polina's Potent Potions" %} Products from Polina's Potent Potions: {% for product in polina_products -%} - {{ product.title }} {%- endfor %} data: {"collection":{"products":[{"title":"Blue Mountain Flower","vendor":"Polina's Potent Potions"},{"title":"Charcoal","vendor":"Ted's Apothecary Supply"},{"title":"Crocodile tears","vendor":"Polina's Potent Potions"},{"title":"Dandelion milk","vendor":"Clover's Apothecary"},{"title":"Draught of Immortality","vendor":"Polina's Potent Potions"},{"title":"Dried chamomile","vendor":"Clover's Apothecary"},{"title":"Forest mushroom","vendor":"Clover's Apothecary"},{"title":"Gift Card","vendor":"Polina's Potent Potions"},{"title":"Glacier ice","vendor":"Ted's Apothecary Supply"},{"title":"Ground mandrake root","vendor":"Clover's Apothecary"},{"title":"Health potion","vendor":"Polina's Potent Potions"},{"title":"Invisibility potion","vendor":"Polina's Potent Potions"},{"title":"Komodo dragon scale","vendor":"Ted's Apothecary Supply"},{"title":"Love Potion","vendor":"Polina's Potent Potions"},{"title":"Mana potion","vendor":"Polina's Potent Potions"},{"title":"Potion beats","vendor":"Polina's Potent Potions"},{"title":"Potion bottle","vendor":"Polina's Potent Potions"},{"title":"Viper venom","vendor":"Ted's Apothecary Supply"},{"title":"Whole bloodroot","vendor":"Clover's Apothecary"}]}} output: Products from Polina's Potent Potions: - Blue Mountain Flower - Crocodile tears - Draught of Immortality - Gift Card - Health potion - Invisibility potion - Love Potion - Mana potion - Potion beats - Potion bottle code: {% assign available_products = collection.products | where: 'available' %} Available products: {% for product in available_products -%} - {{ product.title }} {%- endfor %} data: {"collection":{"products":[{"available":false,"title":"Blue Mountain Flower"},{"available":true,"title":"Charcoal"},{"available":false,"title":"Crocodile tears"},{"available":false,"title":"Dandelion milk"},{"available":true,"title":"Draught of Immortality"},{"available":true,"title":"Dried chamomile"},{"available":false,"title":"Forest mushroom"},{"available":true,"title":"Gift Card"},{"available":false,"title":"Glacier ice"},{"available":true,"title":"Ground mandrake root"},{"available":true,"title":"Health potion"},{"available":true,"title":"Invisibility potion"},{"available":false,"title":"Komodo dragon scale"},{"available":false,"title":"Love Potion"},{"available":true,"title":"Mana potion"},{"available":true,"title":"Potion beats"},{"available":false,"title":"Potion bottle"},{"available":true,"title":"Viper venom"},{"available":true,"title":"Whole bloodroot"}]}} output: Available products: - Charcoal - Draught of Immortality - Dried chamomile - Gift Card - Ground mandrake root - Health potion - Invisibility potion - Mana potion - Potion beats - Viper venom - Whole bloodroot ## Cart filters Cart filters output or modify content specific to the [`cart` object](/docs/api/liquid/objects/cart) and its properties. ### item_count_for_variant Deprecated: false cart | item_count_for_variant: {variant_id} Returns the total item count for a specified variant in the cart. #### Examples code: {{ cart | item_count_for_variant: 39888235757633 }} data: {} output: 1 ### line_items_for Deprecated: false cart | line_items_for: object Returns the subset of cart line items that include a specified product or variant. #### Examples code: {% assign product = all_products['bloodroot-whole'] %} {% assign line_items = cart | line_items_for: product %} Total cart quantity for product: {{ line_items | sum: 'quantity' }} data: {"all_products":{"bloodroot-whole":{}}} output: Total cart quantity for product: 1 code: {% assign product = all_products['bloodroot-whole'] %} {% assign variant = product.variants.first %} {% assign line_items = cart | line_items_for: variant %} Total cart quantity for variant: {{ line_items | sum: 'quantity' }} data: {"all_products":{"bloodroot-whole":{"variants":[]}},"product":{"variants":[]}} output: Total cart quantity for variant: 1 ## Collection filters Collection filters output or modify content specific to the [`collection` object](/docs/api/liquid/objects/collection) and its properties. ### highlight_active_tag Deprecated: false string | highlight_active_tag Wraps a given tag in an HTML `` tag, with a `class` attribute of `active`, if the tag is currently active. Only applies to collection tags. #### Examples code: {% for tag in collection.all_tags %} {{- tag | highlight_active_tag | link_to_tag: tag }} {% endfor %} data: {"collection":{"all_tags":["extra-potent","fresh","healing","ingredients"]},"template":"collection"} output: extra-potent fresh healing ingredients ### link_to_type Deprecated: false string | link_to_type Generates an HTML `` tag with an `href` attribute linking to a collection page that lists all products of the given product type. #### Examples code: {{ 'Health' | link_to_type }} data: {} output: Health code: {{ 'Health' | link_to_type: class: 'link-class' }} data: {} output: Health ### link_to_vendor Deprecated: false string | link_to_vendor Generates an HTML `` tag with an `href` attribute linking to a collection page that lists all products of a given product vendor. #### Examples code: {{ "Polina's Potent Potions" | link_to_vendor }} data: {} output: Polina's Potent Potions code: {{ "Polina's Potent Potions" | link_to_vendor: class: 'link-class' }} data: {} output: Polina's Potent Potions ### sort_by Deprecated: false string | sort_by: string Generates a collection URL with the provided `sort_by` parameter appended. This filter must be applied to a collection URL. #### Examples code: {{ collection.url | sort_by: 'best-selling' }} data: {"collection":{"url":"/collections/sale-potions"}} output: /collections/sale-potions?sort_by=best-selling ### url_for_type Deprecated: false string | url_for_type Generates a URL for a collection page that lists all products of the given product type. #### Examples code: {{ 'health' | url_for_type }} data: {} output: /collections/types?q=health ### url_for_vendor Deprecated: false string | url_for_vendor Generates a URL for a collection page that lists all products from the given product vendor. #### Examples code: {{ "Polina's Potent Potions" | url_for_vendor }} data: {} output: /collections/vendors?q=Polina%27s%20Potent%20Potions ### within Deprecated: false string | within: collection Generates a product URL within the context of the provided collection. #### Examples code: {%- assign collection_product = collection.products.first -%} {{ collection_product.url | within: collection }} data: {"collection":{"products":[{"url":"/products/draught-of-immortality"},{"url":"/products/glacier-ice"},{"url":"/products/health-potion"},{"url":"/products/invisibility-potion"}]}} output: /collections/sale-potions/products/draught-of-immortality ## Color filters Color filters modify or extract properties from CSS color strings. These filters are commonly used with [color theme settings](/themes/architecture/settings/input-settings#color). To learn how to access theme settings, refer to [Settings](/themes/architecture/settings#access-settings). ### brightness_difference Deprecated: false string | brightness_difference: string Calculates the [perceived brightness difference](https://www.w3.org/WAI/ER/WD-AERT/#color-contrast) between two colors. #### Examples code: {{ '#E800B0' | brightness_difference: '#FECEE9' }} data: {} output: 134 ### color_brightness Deprecated: false string | color_brightness Calculates the [perceived brightness](https://www.w3.org/WAI/ER/WD-AERT/#color-contrast) of a given color. #### Examples code: {{ '#EA5AB9' | color_brightness }} data: {} output: 143.89 ### color_contrast Deprecated: false string | color_contrast: string Calculates the contrast ratio between two colors and returns the ratio's numerator. The ratio's denominator, which isn't returned, is always 1. For example, with a contrast ratio of 3.5:1, this filter returns 3.5. #### Examples code: {{ '#E800B0' | color_contrast: '#D9D8FF' }} data: {} output: 3.0 ### color_darken Deprecated: false string | color_darken: number Darkens a given color by a specific percentage. The percentage must be between 0 and 100. #### Examples code: {{ '#EA5AB9' | color_darken: 30 }} data: {} output: #98136b ### color_desaturate Deprecated: false string | color_desaturate: number Desaturates a given color by a specific percentage. The percentage must be between 0 and 100. #### Examples code: {{ '#EA5AB9' | color_desaturate: 30 }} data: {} output: #ce76b0 ### color_difference Deprecated: false string | color_difference: string Calculates the [color difference](https://www.w3.org/WAI/ER/WD-AERT/#color-contrast) between two colors. #### Examples code: {{ '#720955' | color_difference: '#FFF3F9' }} data: {} output: 539 ### color_extract Deprecated: false string | color_extract: string Extracts a specific color component from a given color. #### Examples code: {{ '#EA5AB9' | color_extract: 'red' }} data: {} output: 234 ### color_lighten Deprecated: false string | color_lighten: number Lightens a given color by a specific percentage. The percentage must be between 0 and 100. #### Examples code: {{ '#EA5AB9' | color_lighten: 30 }} data: {} output: #fbe2f3 ### color_mix Deprecated: false string | color_mix: string, number Blends two colors together by a specific percentage factor. The percentage must be between 0 and 100. #### Examples code: {{ '#E800B0' | color_mix: '#00936F', 50 }} data: {} output: #744a90 code: {{ 'rgba(232, 0, 176, 0.75)' | color_mix: '#00936F', 50 }} data: {} output: rgba(116, 74, 144, 0.88) ### color_modify Deprecated: false string | color_modify: string, number Modifies a specific color component of a given color by a specific amount. #### Examples code: {{ '#EA5AB9' | color_modify: 'red', 255 }} data: {} output: #ff5ab9 code: {{ '#EA5AB9' | color_modify: 'alpha', 0.85 }} data: {} output: rgba(234, 90, 185, 0.85) ### color_saturate Deprecated: false string | color_saturate: number Saturates a given color by a specific percentage. The percentage must be between 0 and 100. #### Examples code: {{ '#EA5AB9' | color_saturate: 30 }} data: {} output: #ff45c0 ### color_to_hex Deprecated: false string | color_to_hex Converts a CSS color string to hexadecimal format (`hex6`). #### Examples code: {{ 'rgb(234, 90, 185)' | color_to_hex }} data: {} output: #ea5ab9 ### color_to_hsl Deprecated: false string | color_to_hsl Converts a CSS color string to `HSL` format. #### Examples code: {{ '#EA5AB9' | color_to_hsl }} data: {} output: hsl(320, 77%, 64%) ### color_to_rgb Deprecated: false string | color_to_rgb Converts a CSS color string to `RGB` format. #### Examples code: {{ '#EA5AB9' | color_to_rgb }} data: {} output: rgb(234, 90, 185) ### hex_to_rgba Deprecated: true string | hex_to_rgba Converts a CSS color string from hexadecimal format to `RGBA` format. Shorthand hexadecimal formatting (`hex3`) is also accepted. #### Examples code: {{ '#EA5AB9' | hex_to_rgba }} data: {} output: rgba(234,90,185,1) code: {{ '#EA5AB9' | hex_to_rgba: 0.5 }} data: {} output: rgba(234,90,185,0.5) ## Customer filters Customer filters output URLs that enable customers to interact with their account in the store. ### avatar Deprecated: false customer | avatar Generates HTML to render a customer's avatar, if available. #### Examples ### customer_login_link Deprecated: false string | customer_login_link Generates an HTML link to the customer login page. #### Examples code: {{ 'Log in' | customer_login_link }} data: {} output: Log in ### customer_logout_link Deprecated: false string | customer_logout_link Generates an HTML link to log the customer out of their account and redirect to the homepage. #### Examples code: {{ 'Log out' | customer_logout_link }} data: {} output: Log out ### customer_register_link Deprecated: false string | customer_register_link Generates an HTML link to the customer registration page. #### Examples code: {{ 'Create an account' | customer_register_link }} data: {} output: Create an account ### login_button Deprecated: false shop | login_button Generates an HTML Button that enables a customer to either sign in to the storefront using their Shop account or follow the shop in the Shop App. #### Examples code: data: output: code: data: output: ## Default filters Default filters enable you to use or set default values for certain contexts. ### default Deprecated: false variable | default: variable Sets a default value for any variable whose value is one of the following: - [`empty`](/docs/api/liquid/basics#empty) - [`false`](/docs/api/liquid/basics#truthy-and-falsy) - [`nil`](/docs/api/liquid/basics#nil) #### Examples code: {{ product.selected_variant.url | default: product.url }} data: {"product":{"selected_variant":null,"url":"/products/health-potion"}} output: /products/health-potion code: {%- assign display_price = false -%} {{ display_price | default: true, allow_false: true }} data: {} output: false ### default_errors Deprecated: false string | default_errors Generates default error messages for each possible value of [`form.errors`](/docs/themes/liquid/reference/objects/form#form-errors). #### Examples ### default_pagination Deprecated: false paginate | default_pagination Generates HTML for a set of links for paginated results. Must be applied to the [`paginate` object](/docs/api/liquid/objects/paginate). #### Examples code: {% paginate collection.products by 2 %} {% for product in collection.products %} {{- product.title }} {% endfor %} {{- paginate | default_pagination -}} {% endpaginate %} data: {"collection":{"products":[{"title":"Draught of Immortality"},{"title":"Glacier ice"}],"products_count":4}} output: Draught of Immortality Glacier ice 1 2 Next » ## Font filters Font filters modify [`font` objects](/docs/api/liquid/objects/font), which are defined in font [theme settings](/themes/architecture/settings/input-settings#font). You can use font filters to load fonts or to obtain font variants. To learn how to access theme settings, refer to [Settings](/themes/architecture/settings#access-settings). Refer to [Shopify's font library](/themes/architecture/settings/fonts#available-fonts) for a list of all fonts and their variants. ### font_face Deprecated: false font | font_face Generates a CSS [`@font_face` declaration](https://developer.mozilla.org/en-US/docs/Web/CSS/%40font-face) to load the provided font. #### Examples code: {{ settings.type_header_font | font_face }} data: {} output: @font-face { font-family: Assistant; font-weight: 400; font-style: normal; src: url("//polinas-potent-potions.myshopify.com/cdn/fonts/assistant/assistant_n4.bcd3d09dcb631dec5544b8fb7b154ff234a44630.woff2?h1=cG9saW5hcy1wb3RlbnQtcG90aW9ucy5hY2NvdW50Lm15c2hvcGlmeS5jb20&hmac=f3e05b75609b5d3c9d16b8463b6fc76562a875978049062ab557891e578db7c2") format("woff2"), url("//polinas-potent-potions.myshopify.com/cdn/fonts/assistant/assistant_n4.a2d012304becc2a26f1ded1acc136fcab85c9afd.woff?h1=cG9saW5hcy1wb3RlbnQtcG90aW9ucy5hY2NvdW50Lm15c2hvcGlmeS5jb20&hmac=6d44b2914ff99881162bdebc7eb9807dfa8d152792a77fe369d544274565575a") format("woff"); } code: {{ settings.type_header_font | font_face: font_display: 'swap' }} data: {} output: @font-face { font-family: Assistant; font-weight: 400; font-style: normal; font-display: swap; src: url("//polinas-potent-potions.myshopify.com/cdn/fonts/assistant/assistant_n4.bcd3d09dcb631dec5544b8fb7b154ff234a44630.woff2?h1=cG9saW5hcy1wb3RlbnQtcG90aW9ucy5hY2NvdW50Lm15c2hvcGlmeS5jb20&hmac=f3e05b75609b5d3c9d16b8463b6fc76562a875978049062ab557891e578db7c2") format("woff2"), url("//polinas-potent-potions.myshopify.com/cdn/fonts/assistant/assistant_n4.a2d012304becc2a26f1ded1acc136fcab85c9afd.woff?h1=cG9saW5hcy1wb3RlbnQtcG90aW9ucy5hY2NvdW50Lm15c2hvcGlmeS5jb20&hmac=6d44b2914ff99881162bdebc7eb9807dfa8d152792a77fe369d544274565575a") format("woff"); } ### font_modify Deprecated: false font | font_modify: string, string Modifies a specific property of a given font. #### Examples code: {%- assign bold_font = settings.type_body_font | font_modify: 'weight', 'bold' -%} h2 { font-weight: {{ bold_font.weight }}; } data: {} output: h2 { font-weight: 700; } code: {%- assign bold_font = settings.type_body_font | font_modify: 'weight', 'bold' -%} {%- assign italic_font = settings.type_body_font | font_modify: 'style', 'italic' -%} {%- assign heavy_font = settings.type_body_font | font_modify: 'weight', '900' | default: bold_font -%} {%- assign oblique_font = settings.type_body_font | font_modify: 'style', 'oblique' | default: italic_font -%} h2 { font-style: {{ heavy_font.weight }}; } .italic { {% if oblique_font -%} font-style: {{ oblique_font.style }}; {%- else -%} font-style: {{ italic_font.style }}; {%- endif %} } data: {} output: h2 { font-style: 700; } .italic { font-style: ; } ### font_url Deprecated: false font | font_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for the provided font in `woff2` format. #### Examples code: {{ settings.type_header_font | font_url }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/fonts/assistant/assistant_n4.bcd3d09dcb631dec5544b8fb7b154ff234a44630.woff2?h1=cG9saW5hcy1wb3RlbnQtcG90aW9ucy5hY2NvdW50Lm15c2hvcGlmeS5jb20&hmac=f3e05b75609b5d3c9d16b8463b6fc76562a875978049062ab557891e578db7c2 code: {{ settings.type_header_font | font_url: 'woff' }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/fonts/assistant/assistant_n4.a2d012304becc2a26f1ded1acc136fcab85c9afd.woff?h1=cG9saW5hcy1wb3RlbnQtcG90aW9ucy5hY2NvdW50Lm15c2hvcGlmeS5jb20&hmac=6d44b2914ff99881162bdebc7eb9807dfa8d152792a77fe369d544274565575a ## Format filters Format filters apply formats to specific data types. ### date Deprecated: false string | date: string Converts a timestamp into another date format. #### Examples code: {{ article.created_at | date: '%B %d, %Y' }} data: {"article":{"created_at":"2022-04-14 16:56:02 -0400"}} output: April 14, 2022 code: {{ 'now' | date: '%B %d, %Y' }} data: {} output: December 03, 2024 code: {{ article.created_at | date: format: 'abbreviated_date' }} data: {"article":{"created_at":"2022-04-14 16:56:02 -0400"}} output: Apr 14, 2022 code: {{ article.created_at | date: format: 'month_day_year' }} data: {"article":{"created_at":"2022-04-14 16:56:02 -0400"}} output: April 14, 2022 ### json Deprecated: false variable | json Converts a string, or object, into JSON format. #### Examples code: {{ product | json }} data: {} output: {"id":6792602320961,"title":"Crocodile tears","handle":"crocodile-tears","description":"","published_at":"2022-04-22T11:55:58-04:00","created_at":"2022-04-22T11:55:56-04:00","vendor":"Polina's Potent Potions","type":"","tags":["Salty"],"price":5600,"price_min":5600,"price_max":5600,"available":false,"price_varies":false,"compare_at_price":null,"compare_at_price_min":0,"compare_at_price_max":0,"compare_at_price_varies":false,"variants":[{"id":39888242344001,"title":"Default Title","option1":"Default Title","option2":null,"option3":null,"sku":"","requires_shipping":true,"taxable":true,"featured_image":null,"available":false,"name":"Crocodile tears","public_title":null,"options":["Default Title"],"price":5600,"weight":0,"compare_at_price":null,"inventory_management":"shopify","barcode":"","requires_selling_plan":false,"selling_plan_allocations":[],"quantity_rule":{"min":1,"max":null,"increment":1}}],"images":["\/\/polinas-potent-potions.myshopify.com\/cdn\/shop\/products\/amber-beard-oil-bottle.jpg?v=1650642958"],"featured_image":"\/\/polinas-potent-potions.myshopify.com\/cdn\/shop\/products\/amber-beard-oil-bottle.jpg?v=1650642958","options":["Title"],"media":[{"alt":null,"id":21772501975105,"position":1,"preview_image":{"aspect_ratio":1.5,"height":2974,"width":4460,"src":"\/\/polinas-potent-potions.myshopify.com\/cdn\/shop\/products\/amber-beard-oil-bottle.jpg?v=1650642958"},"aspect_ratio":1.5,"height":2974,"media_type":"image","src":"\/\/polinas-potent-potions.myshopify.com\/cdn\/shop\/products\/amber-beard-oil-bottle.jpg?v=1650642958","width":4460}],"requires_selling_plan":false,"selling_plan_groups":[],"content":""} ### structured_data Deprecated: false variable | structured_data Converts an object into a schema.org structured data format. #### Examples code: data: {} output: ### weight_with_unit Deprecated: false number | weight_with_unit Generates a formatted weight for a [`variant` object](/docs/api/liquid/objects/variant#variant-weight). The weight unit is set in the [general settings](https://www.shopify.com/admin/settings/general) in the Shopify admin. #### Examples code: {%- assign variant = product.variants.first -%} {{ variant.weight | weight_with_unit }} data: {"product":{"variants":[{"weight":200},{"weight":200},{"weight":400},{"weight":200}]}} output: 0.2 kg code: {%- assign variant = product.variants.first -%} {{ variant.weight | weight_with_unit: variant.weight_unit }} data: {"product":{"variants":[{"weight":200,"weight_unit":"g"},{"weight":200,"weight_unit":"g"},{"weight":400,"weight_unit":"g"},{"weight":200,"weight_unit":"g"}]}} output: 200 g ## Hosted file filters Hosted file filters return URLs for assets hosted on the [Shopify CDN](/themes/best-practices/performance/platform#shopify-cdn), including files [uploaded in the Shopify admin](https://help.shopify.com/manual/shopify-admin/productivity-tools/file-uploads). ### asset_img_url Deprecated: false string | asset_img_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for an image in the [`assets` directory](/themes/architecture#assets) of a theme. #### Examples code: {{ 'red-and-black-bramble-berries.jpg' | asset_img_url }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/t/4/assets/red-and-black-bramble-berries_small.jpg?322 code: {{ 'red-and-black-bramble-berries.jpg' | asset_img_url: 'large' }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/t/4/assets/red-and-black-bramble-berries_large.jpg?322 ### asset_url Deprecated: false string | asset_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for a file in the [`assets` directory](/themes/architecture#assets) of a theme. #### Examples code: {{ 'cart.js' | asset_url }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/t/4/assets/cart.js?v=83971781268232213281663872410 ### file_img_url Deprecated: false string | file_img_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for an image from the [Files](https://www.shopify.com/admin/settings/files) page of the Shopify admin. #### Examples code: {{ 'potions-header.png' | file_img_url }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/potions-header_small.png?v=4246568442683817558 code: {{ 'potions-header.png' | file_img_url: 'large' }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/potions-header_large.png?v=4246568442683817558 ### file_url Deprecated: false string | file_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for a file from the [Files](https://www.shopify.com/admin/settings/files) page of the Shopify admin. #### Examples code: {{ 'disclaimer.pdf' | file_url }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/disclaimer.pdf?v=9043651738044769859 ### global_asset_url Deprecated: false string | global_asset_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for a global asset. #### Examples code: {{ 'lightbox.js' | global_asset_url | script_tag }} {{ 'lightbox.css' | global_asset_url | stylesheet_tag }} data: {} output: ### shopify_asset_url Deprecated: false string | shopify_asset_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for a globally accessible Shopify asset. #### Examples code: {{ 'option_selection.js' | shopify_asset_url }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shopifycloud/shopify/assets/themes_support/option_selection-86cdd286ddf3be7e25d68b9fc5965d7798a3ff6228ff79af67b3f4e41d6a34be.js ## HTML filters HTML filters create HTML elements based on Liquid properties or a store’s assets. ### class_list Deprecated: false settings.layout | class_list Generates the list of style classes for a [style setting](/storefronts/themes/architecture/settings/style-settings) or a collection of settings. #### Examples code: {{ settings.layout | class_list }} data: {"settings":{"layout":{}}} output: styles:layout:flex styles:settings:layout ### highlight Deprecated: false string | highlight: string Wraps all instances of a specific string, within a given string, with an HTML `` tag with a `class` attribute of `highlight`. #### Examples code: {% for item in search.results %} {% if item.object_type == 'product' %} {{ item.description | highlight: search.terms }} {% else %} {{ item.content | highlight: search.terms }} {% endif %} {% endfor %} data: {"search":{"results":[{"description":"This is a love potion.","object_type":"product"}],"terms":"love"}} output: This is a love potion. ### inline_asset_content Deprecated: false asset_name | inline_asset_content Outputs the content of an asset inline in the template. The asset must be either a SVG, JS, or CSS file. #### Examples code: {{ 'icon.svg' | inline_asset_content }} data: {} output: '' ### link_to Deprecated: false string | link_to: string Generates an HTML `` tag. #### Examples code: {{ 'Shopify' | link_to: 'https://www.shopify.com' }} data: {} output: Shopify code: {{ 'Shopify' | link_to: 'https://www.shopify.com', class: 'link-class' }} data: {} output: Shopify ### placeholder_svg_tag Deprecated: false string | placeholder_svg_tag Generates an HTML `` tag for a given placeholder name. #### Examples code: {{ 'collection-1' | placeholder_svg_tag }} data: {} output: code: {{ 'collection-1' | placeholder_svg_tag: 'custom-class' }} data: {} output: ### preload_tag Deprecated: false string | preload_tag: as: string Generates an HTML `` tag with a `rel` attribute of `preload` to prioritize loading a given Shopify-hosted asset. The asset URL is also added to the [Link header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link) with a `rel` attribute of `preload`. #### Examples code: {{ 'cart.js' | asset_url | preload_tag: as: 'script' }} data: {} output: code: {{ 'cart.js' | asset_url | preload_tag: as: 'script', type: 'text/javascript' }} data: {} output: ### script_tag Deprecated: false string | script_tag Generates an HTML `

Polina's Potions, LLC
150 Elgin Street
8th floor
Ottawa ON K2P 1L4
Canada

code: {{ customer.default_address | format_address }} data: {} output:

Cornelius Potionmaker
12 Phoenix Feather Alley
1
Calgary AB T1X 0L4
Canada

### translate Deprecated: false string | t Returns a string of translated text for a given translation key from a [locale file](/themes/architecture/locales). #### Examples code: data: output: code: data: output: ## Math filters Math filters perform mathematical operations on numbers. You can apply math filters to numbers, or variables or metafields that return a number. As with any other filters, you can use multiple math filters on a single input. They’re applied from left to right. In the example below, `minus` is applied first, then `times`, and finally `divided_by`. ```liquid You save {{ product.compare_at_price | minus: product.price | times: 100.0 | divided_by: product.compare_at_price }}%``` ### abs Deprecated: false number | abs Returns the absolute value of a number. #### Examples code: {{ -3 | abs }} data: {} output: 3 ### at_least Deprecated: false number | at_least Limits a number to a minimum value. #### Examples code: {{ 4 | at_least: 5 }} {{ 4 | at_least: 3 }} data: {} output: 5 4 ### at_most Deprecated: false number | at_most Limits a number to a maximum value. #### Examples code: {{ 6 | at_most: 5 }} {{ 4 | at_most: 5 }} data: {} output: 5 4 ### ceil Deprecated: false number | ceil Rounds a number up to the nearest integer. #### Examples code: {{ 1.2 | ceil }} data: {} output: 2 ### divided_by Deprecated: false number | divided_by: number Divides a number by a given number. The `divided_by` filter produces a result of the same type as the divisor. This means if you divide by an integer, the result will be an integer, and if you divide by a float, the result will be a float. #### Examples code: {{ 4 | divided_by: 2 }} # divisor is an integer {{ 20 | divided_by: 7 }} # divisor is a float {{ 20 | divided_by: 7.0 }} data: {} output: 2 # divisor is an integer 2 # divisor is a float 2.857142857142857 ### floor Deprecated: false number | floor Rounds a number down to the nearest integer. #### Examples code: {{ 1.2 | floor }} data: {} output: 1 ### minus Deprecated: false number | minus: number Subtracts a given number from another number. #### Examples code: {{ 4 | minus: 2 }} data: {} output: 2 ### modulo Deprecated: false number | modulo: number Returns the remainder of dividing a number by a given number. #### Examples code: {{ 12 | modulo: 5 }} data: {} output: 2 ### plus Deprecated: false number | plus: number Adds two numbers. #### Examples code: {{ 2 | plus: 2 }} data: {} output: 4 ### round Deprecated: false number | round Rounds a number to the nearest integer. #### Examples code: {{ 2.7 | round }} {{ 1.3 | round }} data: {} output: 3 1 code: {{ 3.14159 | round: 2 }} data: {} output: 3.14 ### times Deprecated: false number | times: number Multiplies a number by a given number. #### Examples code: {{ 2 | times: 2 }} data: {} output: 4 ## Media filters Media filters enable you to render media associated with various store resources, such as [products](/docs/api/liquid/objects/product) and [collections](/docs/api/liquid/objects/collection). ### article_img_url Deprecated: true variable | article_img_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for an [article's image](/docs/api/liquid/objects/article#article-image). #### Examples code: {{ article.image | article_img_url }} data: {"article":{"image":"articles/beakers-for-science-with-water.jpg"}} output: //polinas-potent-potions.myshopify.com/cdn/shop/articles/beakers-for-science-with-water_small.jpg?v=1654385193 code: {{ article.image | article_img_url: 'large' }} data: {"article":{"image":"articles/beakers-for-science-with-water.jpg"}} output: //polinas-potent-potions.myshopify.com/cdn/shop/articles/beakers-for-science-with-water_large.jpg?v=1654385193 ### collection_img_url Deprecated: true variable | collection_img_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for a [collection's image](/docs/api/liquid/objects/collection#collection-image). #### Examples code: {{ collection.image | collection_img_url }} data: {"collection":{"image":"collections/sale-written-in-lights.jpg"}} output: //polinas-potent-potions.myshopify.com/cdn/shop/collections/sale-written-in-lights.jpg?v=1657654130 code: {{ collection.image | collection_img_url: 'large' }} data: {"collection":{"image":"collections/sale-written-in-lights.jpg"}} output: //polinas-potent-potions.myshopify.com/cdn/shop/collections/sale-written-in-lights_large.jpg?v=1657654130 ### external_video_tag Deprecated: false variable | external_video_tag Generates an HTML ` code: {% for media in product.media %} {% if media.media_type == 'external_video' %} {% if media.host == 'youtube' %} {{ media | external_video_url: color: 'white' | external_video_tag: class:'youtube-video' }} {% endif %} {% endif %} {% endfor %} data: {} output: ### external_video_url Deprecated: false media | external_video_url: attribute: string Returns the URL for a given external video. Use this filter to specify parameters for the external video player generated by the [`external_video_tag` filter](/docs/api/liquid/filters/external_video_tag). #### Examples code: {% for media in product.media %} {% if media.media_type == 'external_video' %} {% if media.host == 'youtube' %} {{ media | external_video_url: color: 'white' | external_video_tag }} {% elsif media.host == 'vimeo' %} {{ media | external_video_url: loop: '1', muted: '1' | external_video_tag }} {% endif %} {% endif %} {% endfor %} data: {} output: ### image_tag Deprecated: false string | image_tag Generates an HTML `` tag for a given [`image_url`](/docs/api/liquid/filters/image_url). #### Examples code: {{ product | image_url: width: 200 | image_tag }} data: {} output: Health potion code: data: {} output: code: {{ images['potions-header.png'] | image_url: width: 300 | image_tag }} data: {} output: code: {{ product | image_url: width: 400 | image_tag: width: 300 }} {{ product | image_url: width: 400 | image_tag: width: nil }} data: {} output: Health potion Health potion code: {{ product | image_url: width: 400 | image_tag: height: 300 }} {{ product | image_url: width: 400 | image_tag: height: nil }} data: {} output: Health potion Health potion code: {{ product | image_url: width: 200 | image_tag: sizes: '(min-width:1600px) 960px, (min-width: 750px) calc((100vw - 11.5rem) / 2), calc(100vw - 4rem)' }} data: {} output: Health potion code: {{ product | image_url: width: 600 | image_tag: widths: '200, 300, 400' }} data: {} output: Health potion code: {{ product | image_url: width: 200 | image_tag: srcset: nil }} data: {} output: Health potion code: data: output: code: {{ product | image_url: width: 200 | image_tag: alt: "My image's alt text" }} data: {} output: My image's alt text code: {{ product | image_url: width: 200 | image_tag: class: 'custom-class', loading: 'lazy' }} data: {} output: Health potion ### image_url Deprecated: false variable | image_url: width: number, height: number Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for an image. #### Examples code: {{ product | image_url: width: 450 }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new.jpg?v=1683744744&width=450 code: {{ product | image_url: width: 450 }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new.jpg?v=1683744744&width=450 code: {{ product | image_url: height: 450 }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new.jpg?height=450&v=1683744744 code: {{ product | image_url: width: 400, height: 400, crop: 'bottom' }} {{ product | image_url: crop: 'region', crop_left: 32, crop_top: 32, crop_width: 512, crop_height: 512 }} {{ product | image_url: crop: 'region', width: 100, height: 100, crop_left: 32, crop_top: 32, crop_width: 512, crop_height: 512 }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new.jpg?crop=bottom&height=400&v=1683744744&width=400 //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new.jpg?crop=region&crop_height=512&crop_left=32&crop_top=32&crop_width=512&v=1683744744 //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new.jpg?crop=region&crop_height=512&crop_left=32&crop_top=32&crop_width=512&height=100&v=1683744744&width=100 code: {{ product | image_url: width: 450, format: 'pjpg' }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new.jpg?format=pjpg&v=1683744744&width=450 code: {{ product | image_url: width: 400, height: 400, pad_color: '000' }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new.jpg?height=400&pad_color=000&v=1683744744&width=400 ### img_tag Deprecated: true string | img_tag Generates an HTML `` tag for a given image URL. #### Examples code: {{ product | img_tag }} data: {} output: code: {{ product | img_tag: 'image alt text', '', '450x450' }} data: {} output: image alt text ### img_url Deprecated: true variable | img_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for an image. #### Examples code: {{ product | img_url }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744 code: {{ product | img_url: '480x' }} {{ product | img_url: 'x480' }} {{ product | img_url: '480x480' }} {{ product | img_url: 'large' }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_480x.jpg?v=1683744744 //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_x480.jpg?v=1683744744 //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_480x480.jpg?v=1683744744 //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_large.jpg?v=1683744744 code: {{ product | img_url: crop: 'bottom' }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744 code: {{ product | img_url: format: 'pjpg' }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744 code: {{ product | img_url: scale: 2 }} data: {} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744 ### media_tag Deprecated: false media | media_tag Generates an appropriate HTML tag for a given media object. #### Examples code: {% for media in product.media %} {{- media | media_tag }} {% endfor %} data: {} output: code: {% for media in product.media %} {{- media | media_tag: image_size: '400x' }} {% endfor %} data: {} output: ### model_viewer_tag Deprecated: false media | model_viewer_tag Generates a [Google model viewer component](https://modelviewer.dev/) for a given 3D model. #### Examples code: {% for media in product.media %} {% if media.media_type == 'model' %} {{ media | model_viewer_tag }} {% endif %} {% endfor %} data: {} output: code: {% for media in product.media %} {% if media.media_type == 'model' %} {{ media | model_viewer_tag: interaction-policy: 'allow-when-focused' }} {% endif %} {% endfor %} data: {} output: code: {% for media in product.media %} {% if media.media_type == 'model' %} {{ media | model_viewer_tag: image_size: '400x' }} {% endif %} {% endfor %} data: {} output: ### product_img_url Deprecated: true variable | product_img_url Returns the [CDN URL](/themes/best-practices/performance/platform#shopify-cdn) for a [product image](/docs/api/liquid/objects/product). #### Examples code: {{ product.featured_image | product_img_url }} data: {"product":{"featured_image":"files/science-beakers-blue-light-new.jpg"}} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_small.jpg?v=1683744744 code: {{ product.images[0] | product_img_url: 'large' }} data: {"product":{"images":["files/science-beakers-blue-light-new.jpg","products/science-beakers-blue-light.jpg","files/science-beakers-blue-light_9c5badcd-ea54-4ddc-916c-a45c6c67c704.jpg","files/science-beakers-blue-light_40984233-47bf-4b8b-844c-88020e3da712.jpg"]}} output: //polinas-potent-potions.myshopify.com/cdn/shop/files/science-beakers-blue-light-new_large.jpg?v=1683744744 ### video_tag Deprecated: false media | video_tag Generates an HTML `