Liquid、JavaScriptなどに関する質問
こんにちは!お世話になります!
カスタマイズで選択した複数の商品をトップページ上に表示するセクションを作っています。(自作のセクションになります)カスタマイズ画面では問題なく商品を追加できるのですが、画像のように商品の画像、タイトル、URL等が呼び出せません。
試したこと
DevToolによる検証:{{ product.title }} 、 {{ product.url }}などの該当部分が空白になっていました。
サイトのビュー
<div class="Three-One E-secondWrapper E-wrapper">
<div class="L-wrapper"><h2 class="L-title">{% if section.settings.title == "" %}{{ 'sections.pick-up-items.title' | t }}{% else %}{{ section.settings.tltle }}{% endif %}</h2></div>
<div id="threeOne-item">
<div class="swiper-container5">
<div class="swiper-wrapper">
{% for block in section.blocks limit: section.blocks.size %}
{%- assign product = all_products[block.settings.featured_product] -%}
{% if product.available %}
<div class="swiper-slide swipeto"><a href="{{ product.url }}">
<img src="{{ product.featured_image | img_url: 'large' }}" alt="{{ product.featured_image.alt | escape }}">
</a><p>{{ product.title }}</p></div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
{% schema %}
{
"name": "home pickups",
"settings": [
{
"type": "header",
"content": "recommendations",
"info": "recommendations"
},
{
"type": "text",
"id": "title",
"label": "title"
},
{
"type": "checkbox",
"id": "design_check",
"label": "check and design will be changed",
"default": true
}
],
"blocks": [
{
"type": "slide",
"name": "slide",
"settings": [
{
"id": "product",
"type": "product",
"label": "Featured Products"
}
]
}
],
"presets": [
{
"name": "home pickups",
"category": "home page"
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
どなたか、お力添え頂けますと幸いです。
よろしくお願いいたします。
解決済! ベストソリューションを見る。
成功
"settings": [
{
"id": "product",
"type": "product",
"label": "Featured Products"
}
]
この部分のid:"product" を "id":"featured_product" にすることで解決しませんか?
成功
"settings": [
{
"id": "product",
"type": "product",
"label": "Featured Products"
}
]
この部分のid:"product" を "id":"featured_product" にすることで解決しませんか?
"blocks": [
{
"type": "slide",
"name": "slide",
"settings": [
{
"id": "featured_product",
"type": "product",
"label": "Featured Products"
}
]
}
],
以上のコードで試してみまたが以下の画像のようになりました・・・。
すみません。カスタマイズ画面にて商品を追加していませんでした。
商品を表示することが出来ましたが、一つの商品しか表示されませんでした。2つめ以降の商品を表示する方法は御座いますか?
キャッシュを消去した結果すべての商品が表示されました。 kakuma-fblさんどうもありがとう御座います
Shopify アカデミーの学習パスと認定スキルバッジExpanding Your Shopify Business Internationallyを活用して、国際的にビジネ...
By Shopify Feb 7, 2025Shopify アカデミーの学習パスB2B on Shopify:立ち上げとカスタマイズで卸売販売に進出しましょう。これら3つの無料コースは、ShopifyストアでB2B機能...
By Shopify Jan 31, 2025サポートの選択肢が増えていく中、最適となる選択の判断が難しくなっているかと存じます。今回は問題の解決に最適となるサポートの選択方法を、紹介させて頂きます。 選択肢のご紹介...
By Mirai Oct 6, 2024