FROM CACHE - jp_header
このコミュニティはピアツーピアサポートに移行しました。Shopify サポートは今後、このコミュニティへのサービスを提供いたしません。これからもぜひ、他のマーチャントやパートナーとつながり、サポートし合い、経験を共有してください。 当社の行動規範に違反する行動や削除を希望するコンテンツがありましたら、引き続きご報告ください

コレクションの商品表示について

解決済

コレクションの商品表示について

kumansman
Shopify Partner
13 1 2

Udemy(Build a Shopify Theme from scratch)https://www.udemy.com/share/1023tcAEIddF9bRn0D/

の教材に沿ってliquidのコード編集をしています。

 

【質問内容】

コレクションに追加した商品・画像・価格が反映されません。

商品登録はインポートでcsvから引っ張ってきております。

コードは教材と照らし合わせて問題ないかと思っているのですが、どういう問題が考えられますでしょうか。

 

初歩的な質問で申し訳ございませんが、アドバイス頂けるとありがたいです。

 

【画像1】【画像1】

 

【画像2】【画像2】

 

 

 <section class="products section bg-gray">
    <div class="container">
      <div class="row">
        <div class="col-md-12">
          <div class="title text-center">
          <h2>Trending Products</h2>
        </div>
      </div>
      {% assign collection = collections[section.settings.collection] %}

      <div class="row">
        {% for product in collection.products limit: section.settings.product_limit %}
       <div class="col-md-4">
            <div class="product-item">
              <div class="product-thumb">
              {% if product.compare_at_price and product.compare_at_price != product.price %}
              <span class="bage">Sale</span>
              {% endif %}

              <img class="img-responsive" src="{‌{product.featured_image.src | img_url: '1920x'}}">
              <div class="preview-meta">
                <ul>
                  <li>
                    <a href="{‌{product.url}}"><i class="fa fa-search"></i></a>
                  </li>
                  <li>
                    <a href=""><i class="fa fa-shopping-cart"></i></a>
                  </li>
                </ul>
              </div>
            </div>
            <div class="product-content">
              <h4><a href="{‌{product.url}}">{‌{product.title}}</a></h4>
              <p class="price">{‌{product.price | money}}</p>
            </div>
          </div>
        </div>
        {% endfor %}
      </div>
    </div>
  </div>
</section>

{% schema %}
  {
    "name": "Homepage Products",
    "settings": [
      {
        "type": "text",
        "id": "title",
        "label": "Heading",
        "default": "Tranding Products"
      },
      {
        "type": "collection",
        "id": "collection",
        "label": "Collection"
      },
      {
        "type": "range",
        "id": "product_limit",
        "label": "Product Limit",
        "min": 3,
        "max": 9,
        "default": 6
      }
    ]
  }
{% endschema %}

 

1 件の受理された解決策

junichiokamura
Community Manager
1201 280 510

成功

 セクションのプレビューをみると、LiquidのObjectが、そのままテキスト処理されているように見えるので、 {{ product.url }} のように、括弧と変数の間にスペースを入れてみても同じでしょうか?

参考

https://www.shopify.jp/blog/partner-shopify-template-language-liquid-overview

https://shopify.dev/docs/themes/liquid/reference

Senior Partner Solutions Engineer

元の投稿で解決策を見る

2件の返信2

junichiokamura
Community Manager
1201 280 510

成功

 セクションのプレビューをみると、LiquidのObjectが、そのままテキスト処理されているように見えるので、 {{ product.url }} のように、括弧と変数の間にスペースを入れてみても同じでしょうか?

参考

https://www.shopify.jp/blog/partner-shopify-template-language-liquid-overview

https://shopify.dev/docs/themes/liquid/reference

Senior Partner Solutions Engineer
kumansman
Shopify Partner
13 1 2

junichiokamura様

ご連絡ありがとうございます。

早速、ご指摘いただいた所、修正いたしました。

{{ }}のところがうまく読み込めておらず、全て{{ }}を書き直したら直りました。

お忙しいところ、初歩的なミスにアドバイスいただきありがとうございました。