⚠️ These docs are only for the Adapter Legacy. If you are using the new App, you must refer to the University! ⚠️

Metafields

The metafields object is a powerful tool that allows users to expand the standard Shopify functionality, modify themes and integrate custom apps by adding additional data to the main resources such as products, collections and blogs. There are many apps in Shopify that allow you to edit metafields, there is one that is Free of charge and we usually use and is Metafield Guru.

Note: a metafield can be defined by two features: Namespace and Key.

Namespace is used to group different metafields and by default is global.

Key is used to reference a specific metafield and the value is up to you. Please remind that it can't contain spaces neither uppercase characters.

Namespace

By default the adapter will use global as value for the namespace. On ALL the elements defined below you can add the optional attribute:

namespaceyour-namespace-name

to change the namespace to use.

Article Metafields

Below you will find all the attributes that can be used to use Metafield for articles.

Text

On any text you can add the attribute

article-metafield:textmetafield-key

To output the value of the metafield as text content of the element where the attribute is applied to.

For example: if you add

article-metafield:textmy_custom_subheading

on a heading element, you will get the following liquid output:

<h2>{{article.metafields.global.my_custom_subheading}}</h2>

Image

You can add this attribute to any image or background image:

article-metafield:imagemetafield-key

Shopify automatically compress the photo, and optimizes the photo, you can add the following optional attributes to change shopify parameters

Dimension

you can change the size of the featured image, you can add the following optional attribute:

dimensiondimension of the image

As for valid dimension you can use these prefixed values below, ordered by largest to smallest:

master,grande, large, medium, compact, small, thumb, icon, pico

or you can set a fixed width x height (or just one of the parameters):

{width}x{height}, {width}x, x{height}

For example to set a fixed size image of 300x500 add the attribute

dimension300x500
Crop

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.

You can specify crop using the attribute:

cropcrop position

Valid options are:

top, center, bottom, left and right

Scale

The scale parameter lets you specify the pixel density of the image. You can add it using the attribute:

scalescale factor

Valid options are:

2 and 3

Format

The format parameter lets you specify what file format to use for the displayed image.

You can specify it adding the attribute:

formatformat type

Valid options are:

jpg and 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.

Note that Shopify can do the only the following format conversions for you:

  • PNG to JPG
  • PNG to PJPG
  • JPG to PJPG

Color

You can add this attribute to any text element to modify the color:

article-metafield:colormetafield-key

Border Color

You can add this attribute to any element to modify the border color:

article-metafield:brcolormetafield-key

Background Color

You can add this attribute to any element to modify the background color:

article-metafield:bgcolormetafield-key

You can add this attribute to any link element to modify the src attribute:

article-metafield:linkmetafield-key

Product Metafields

Below you will find all the attributes that can be used to use Metafield for products.

Text

On any text you can add the attribute

product-metafield:textmetafield-key

To output the value of the metafield as text content of the element where the attribute is applied to.

For example: if you add

product-metafield:textmy_custom_subheading

on a heading element, you will get the following liquid output:

<h2>{{product.metafields.global.my_custom_subheading}}</h2>

Image

You can add this attribute to any image or background image:

product-metafield:imagemetafield-key

Shopify automatically compress the photo, and optimizes the photo, you can add the following optional attributes to change shopify parameters

Dimension

you can change the size of the featured image, you can add the following optional attribute:

dimensiondimension of the image

As for valid dimension you can use these prefixed values below, ordered by largest to smallest:

master,grande, large, medium, compact, small, thumb, icon, pico

or you can set a fixed width x height (or just one of the parameters):

{width}x{height}, {width}x, x{height}

For example to set a fixed size image of 300x500 add the attribute

dimension300x500
Crop

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.

You can specify crop using the attribute:

cropcrop position

Valid options are:

top, center, bottom, left and right

Scale

The scale parameter lets you specify the pixel density of the image. You can add it using the attribute:

scalescale factor

Valid options are:

2 and 3

Format

The format parameter lets you specify what file format to use for the displayed image.

You can specify it adding the attribute:

formatformat type

Valid options are:

jpg and 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.

Note that Shopify can do the only the following format conversions for you:

  • PNG to JPG
  • PNG to PJPG
  • JPG to PJPG

Color

You can add this attribute to any text element to modify the color:

product-metafield:colormetafield-key

Border Color

You can add this attribute to any element to modify the border color:

product-metafield:brcolormetafield-key

Background Color

You can add this attribute to any element to modify the background color:

product-metafield:bgcolormetafield-key

You can add this attribute to any link element to modify the src attribute:

product-metafield:linkmetafield-key

Collection Metafields

Below you will find all the attributes that can be used to use Metafield for products.

Text

On any text you can add the attribute

collection-metafield:textmetafield-key

To output the value of the metafield as text content of the element where the attribute is applied to.

For example: if you add

collection-metafield:textmy_custom_subheading

on a heading element, you will get the following liquid output:

<h2>{{collection.metafields.global.my_custom_subheading}}</h2>

Image

You can add this attribute to any image or background image:

collection-metafield:imagemetafield-key

Shopify automatically compress the photo, and optimizes the photo, you can add the following optional attributes to change shopify parameters

Dimension

you can change the size of the featured image, you can add the following optional attribute:

dimensiondimension of the image

As for valid dimension you can use these prefixed values below, ordered by largest to smallest:

master,grande, large, medium, compact, small, thumb, icon, pico

or you can set a fixed width x height (or just one of the parameters):

{width}x{height}, {width}x, x{height}

For example to set a fixed size image of 300x500 add the attribute

dimension300x500
Crop

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.

You can specify crop using the attribute:

cropcrop position

Valid options are:

top, center, bottom, left and right

Scale

The scale parameter lets you specify the pixel density of the image. You can add it using the attribute:

scalescale factor

Valid options are:

2 and 3

Format

The format parameter lets you specify what file format to use for the displayed image.

You can specify it adding the attribute:

formatformat type

Valid options are:

jpg and 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.

Note that Shopify can do the only the following format conversions for you:

  • PNG to JPG
  • PNG to PJPG
  • JPG to PJPG

Color

You can add this attribute to any text element to modify the color:

collection-metafield:colormetafield-key

Border Color

You can add this attribute to any element to modify the border color:

collection-metafield:brcolormetafield-key

Background Color

You can add this attribute to any element to modify the background color:

collection-metafield:bgcolormetafield-key

You can add this attribute to any link element to modify the src attribute:

collection-metafield:linkmetafield-key