[Shopify]Liquidで取得できる商品データ一覧 Product Object まとめ一覧

[Shopify]Liquidで取得できる商品データ一覧 Product Object まとめ一覧

What we introduce here is a list of data that can be obtained as Product Information. Since there was no information in Japanese, we thought it would be a good opportunity to compile it.

For example, when outputting the title of a product in Liquid

{{ product.title }}

But there is a lot of other information that can be obtained, so I will try to list it here.

By the way, a variant is the type of product in question. For example, if a product has different colors and sizes, we can say that the product has a variant.

product.available (availability)

Obtains the availability of the product. Returns false if all variants of the product are out of stock. Returns true if the item is available for purchase.

{{ product.available }}

product.collections (Collection to which the product belongs)

It is possible to retrieve the collection to which the product belongs. See Liquid below for the method of acquisition.

{% for collection in product.collections %}
<p>{{ collection.title }}</p>
{% endfor %}

For example, to display the title name of a collection to which it belongs.

product.content (Product details and description text)

Displays the part of the product description entered on the administration screen. The same for product.description.

{{ product.content }}

product.created_at (Date product was created in admin)

Get the date the product was created in the admin, note that this is different from product.published_date.

{{ product.created_at }}

product.featured_img (Main image of the product)

Displays the main image of the product. However, be careful when using it in <img> tags. Use the following

<img src="{{ product.featured_img | img_url }}">


The first available variant of the product to be purchased. For example, when retrieving the title of the relevant VARIANT, you can use the

{{ product.first_available_variant.title }}

The following is a description of the product.

product.gift_card? (Determines if it is a gift card product)

Return true if the product is a gift card product. A gift card product is a product created from Product Management -> Gift Card.

product.handle (Product handle URL)

The handle URL of the product. For example


the "white-shirt" at the end is the handle name.

{{ product.handle }}

product.has_only_default_variant (determine if the product has only one variant)

Return true if the product has only one variant.

{{ product.has_only_default_variant }}

product.id (Product ID)

Returns the id of the product. The id of a product is unique and is included in the URL when accessing the product from the admin page.

{{ product.id }}

product.images (Product image list)

A list of product images can be output. Images are returned as an array, so the following description is required.

{% for image in product.images %}
<img src="{{ image.src | img_url }}">
{% endfor %}

product.options (Product options)

Displays product options. Options are the multiple types of items in a product.

For example, for a specific product

  • Color → Blue, Purple
  • Size → S, M, L

The "color" and "size" parts become options if there are two types of "color" and "size.

By the way, the variations are

  1. Blue S
  2. Blue M
  3. Blue L
  4. Purple S
  5. Purple M
  6. Purple L

There are six ways to do this.

The method of acquisition is as follows, as this is also returned as an array.

{% for option in product.options %}
<p>{{ option }}</p>
{% endfor %}

You can also output the option names "color" and "size" as in the following, or if you want to find out how many options there are, you can use

{{ product.options.color }}

and how many values are available for the option "color".

product.options_by_name (get product options)

The name of the option can be specified and retrieved.

{% for color_option in product.options_by_name["color"].values %}
{{ color_option
}}{% endfor %}

would output the "Blue, Purple" option for the option name "Color".

product.options_by_value (value of product options)

You can get the entire contents of the product options.

  • Option name → "Color", "Size".
  • Option value → "blue, purple" "S, M, L

So there is a theory that knowing this is enough to get around the options. The following is a description.

{% for product_option in product.options_with_values %}
<p>Option name: {{ product_option.name }}</p>
{%for value in product_option.values


<li>Option value: {{ value }}</li> {
% endfor


product.price (product price)

Commodity price. If there are multiple variants with different prices, the lowest price will be displayed.

{{ product.price }}

product.price_max (highest variant price in the product)

The highest product price among the variants.

{{ product.price_max }}

product.price_min (lowest variant price in the product)

The lowest commodity price among the variants.

{{ product.price_min }}

product.published_at (Date the product was published)

Get the date when the product was published. Note that this is different from the product's registration date.

{{ product.published_at }}

product.selected_variant (selected variant)

Gets the variant selected by URL criteria and returns a variant object. If the variant is not specified in the URL, nil is returned.

For example, if you want to get sku of the selected variant, use the following description.

{{ product.selected_variant.sku }}


Like product.selected_variant, it retrieves the variant selected by URL criteria, and if not selected by URL criteria, returns the variant available for purchase that is in stock.

{{ product.selected_or_first_available_variant.sku }}

product.tags (Product tags)

Get the tag of the product. Returns an array of product tags; when retrieving tags in Liquid, use the following

{% for tag in product.tags %}
<p>{{ tag }}</p>
{% endfor %}

product.template_suffix (name of the template to be applied to the product)

Name of the product template selected in the admin panel. If the default product template is "nil" and a custom template is applied, the output will be "custom" if product.custom.liquid is used.

{{ product.template_suffix }}

product.title (Product title)

Most frequently used product information. Returns the product title.

{{ product.title }}

product.type (Product type)

Returns the product type.

{{ product.type }}

product.url (Product URL)

Returns the URL of the product. Unlike the handle (product.handle), the product URL is output including /products/, such as "/products/white-shirt".

{{ product.url }}

product.variants (List of product variants)

Returns a list of product variants as an array, see below for how to write Liquid.

{% for variant in product.variants %}
{{ variant.sku
}}{% endfor %}

Example of getting sku of a variant.

product.vendor (product vendor)

Returns the distributor of the product.

{{ product.vendor }}

List of product data that can be retrieved with [Shopify]Liquid Product Object List Summary

The above is a list of values that can be obtained as product information. It is no exaggeration to say that product information is the most used information. On the other hand, since the information is mainly in English and I felt there was not much information in Japanese, I summarized it in Japanese this time. I would be happy if it could be of some help to you.

Thank you for reading to the end! Have a great day!

Contact form