Deprecated filters
The following Liquid filters are deprecated, and have been replaced by the alternatives that are listed below.
Color filters
Anchor link to section titled "Color filters"The following color filters are now deprecated:
hex_to_rgba
Anchor link to section titled "hex_to_rgba"Theme settings return hexadecimal values for color settings by default. Use the hex_to_rgba
filter to convert the value into RGBA. The default is an opacity of 1
, however you can specify an opacity between 0 and 1. Shorthand hex values, like #812
, are accepted as well.
HTML filters
Anchor link to section titled "HTML filters"The following HTML filters are now deprecated:
currency_selector
Anchor link to section titled "currency_selector"Generates a drop-down list that customers can use to select an accepted currency on your storefront. This filter must be used on the form
object within a currency form.
Generates an image tag.
The img_tag
filter accepts parameters to output an alt tag, class names, and a size parameter:
- The first parameter is output as the alt text.
- The second parameter is the css class, or classes to be applied to the tag.
- The last parameter is the image size parameter.
The img_tag
filter can also be used on the following objects:
URL filters
Anchor link to section titled "URL filters"The following url filters are now deprecated:
collection_img_url
Anchor link to section titled "collection_img_url"Returns the collection image's URL. Accepts an image size as a parameter.
Returns the URL of an image. Accepts image size parameters. You can use img_url
on the following objects:
The img_url
filter should be followed by the image size that you want to use. If you request a size smaller than your original image's dimensions, Shopify will scale the image for you.
If you don't include an image size, the filter returns a small (100x100) image.
You can also use img_url
on the image
or src
attributes of an object.
img_url
can't transform icon files (.ico
). If you specify a size or format for an icon file, img_url
will return the original file.
Size parameters
Anchor link to section titled "Size parameters"You can use size parameters on this page for the following URL filters:
img_url
used in some older themesasset_img_url
file_img_url
You can specify exact dimensions in pixels for an image's width and height, up to a maximum of 5760 x 5760 px. The image's original aspect ratio will be preserved unless you crop the image.
No matter what size you specify, an image can never be resized to be larger than its original dimensions.
For example:
You can specify only a width or only a height and Shopify will calculate the other dimension based on the original image size, keeping the original image's aspect ratio:
If you don't want the image resized, you can get the original image size:
You can specify a crop
parameter to make sure that the resulting image's dimensions match the requested dimensions. If the entire image won't fit in your requested dimensions, the crop
parameter specifies what part of the image to show. Valid options are:
top
center
bottom
left
right
If you don't use crop
, Shopify will use the largest image that fits in your specified dimensions, which might not take up the whole space.
The scale
parameter lets you specify the pixel density of the image. Valid options are:
2
3
The format
parameter lets you specify what file format to use for the displayed image. Valid options are:
jpg
pjpg
pjpg
is progressive JPEG. A browser loads a full-sized progressive JPEG with gradually increasing quality, instead of loading the full-quality image from top to bottom like a traditional JPEG.
product_img_url
Anchor link to section titled "product_img_url"Generates the product image URL. Accepts an image size as a parameter.
Named size parameters
Anchor link to section titled "Named size parameters"Instead of using a numeric image size, you can use a named size as a parameter for the following URL filters:
img_url
used in some older themesasset_img_url
file_img_url
Name | Maximum image size |
---|---|
pico | 16 x 16 pixels |
icon | 32 x 32 pixels |
thumb | 50 x 50 pixels |
small | 100 x 100 pixels |
compact | 160 x 160 pixels |
medium | 240 x 240 pixels |
large | 480 x 480 pixels |
grande | 600 x 600 pixels |
original | 1024 x 1024 pixels |
Date formats
Anchor link to section titled "Date formats"Date formats are used with certain filters, such as time_tag
and date
.
The following format
parameters are now deprecated:
short
long