0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

shopify:商品に付与された tag の有無で要素を出し分ける

Posted at

商品詳細ページでタグの有無で要素を出し分けたい。

product.tags.sizeでtagsのサイズが0以上ならばtagが存在している。
なので、そいつを使って出し分ける

{% if product.tags.size > 0 %}
  // 要素
{% endif %}

デフォルトのテンプレート内を見るとサムネイルの出し分けに同じようなコードがあった。

 {% if product.images.size > 1 %}

画像は1つ以上登録されて入ればサムネイルの一覧を出すという事です。
なるほど。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?