Liquid、JavaScriptなどに関する質問
はじめまして。よろしくお願いいたします。
使用テーマ:Brooklyn
在庫0にした特定商品を「近日入荷」という形で購入ボタン等を無くした状態で表示させたいのですが、
カスタマイズ方法、もしくはアプリ等ありましたらご教示くださいますようお願い申し上げます。
言語編集で「sold out」のテキストを変更するのは、全商品のテキストが変わってしまうので利用できません。
また、予約販売ではなく、あくまで「近日入荷」という形で、「購入ボタン」や「予約ボタン」などは表示させず、お問い合わせフォームへのボタンを表示させる形にしたいと考えておりますので、
予約販売機能のアプリとは異なります。
MAKESHOPの「販売予告機能」のような感じです。
https://www.makeshop.jp/main/function/announce/
よろしくお願いいたします。
1.そうしたい商品にTagを設定する ここでは coming_soon を設定
2.以下のコードをSections / product-template.liquid のどっか適当に入れる
3.商品にcoming_soonのタグが付いていて、在庫が無い場合 COMMING SOON (ここのカートボタンとかを入れる)が表示される
購入ボタンのタグなどをこちらの中に入れてあげれば制御できます。
{% for tag_product in product.tags %}
{% if tag_product contains 'coming_soon' %}
{% unless product.available == true %}
COMMING SOON (ここのカートボタンとかを入れる)
{% endunless %}
{% endif %}
{% endfor %}
ありがとうございます。
ご教示頂いた方法で在庫ゼロの商品にのみ「COMMING SOON (ここのカートボタンとかを入れる)」を表示させることができますが、
商品個別ページの「売り切れボタン」や、コレクションページで並んだ際に表示される「売り切れ」マークはそのままになってしまいます。
商品個別ページで「売り切れボタン」を非表示。
コレクションページで並んだ際に表示される「売り切れマーク」を「COMMING SOON」等の表示に変更するにはどうすればよろしいでしょうか?
よろしくお願いいたします。
Snippetsのproduct-grid-item.liquidで
{% if sold_out %}
を探して、
以下を入れれば
対象商品でcoming_soonのtagが付与された商品で在庫が無い場合は
Collectionページ内の商品に、COMING SOONをSOLD OUTの代わりに表示します。
{% for tag_product in product.tags %}
{% if tag_product contains 'coming_soon' %}
<div class="grid-product__sold-out">
<p>COMING<br /> SOON</p>
</div>
{% break %}
{% else %}
<div class="grid-product__sold-out">
<p>{{ 'products.product.sold_out_html' | t }}</p>
</div>
{% endif %}
{% endfor %}
ありがとうございます。
下記のように入れたところ、「coming_soon」タグが付与されている商品に「coming_soon」が表示されるようになりましたが、ソールドアウト商品に「売り切れ」表示が出なくなりました。
{% if sold_out %}
{% for tag_product in product.tags %}
{% if tag_product contains 'coming_soon' %}
<div class="grid-product__sold-out">
<p>COMING<br /> SOON</p>
</div>
{% break %}
{% else %}
<div class="grid-product__sold-out">
<p>{{ 'products.product.sold_out_html' | t }}</p>
</div>
{% endif %}
{% endfor %}
{% elsif on_sale %}
<div class="grid-product__on-sale">
{% capture discount_percentage %}{{ product.compare_at_price | minus: product.price | times: 100 | divided_by: product.compare_at_price |round }}%{% endcapture %}
<p>{{ 'products.general.save_html' | t: saved_amount: discount_percentage }}</p>
</div>
{% endif %}
</div>
そこで、売り切れでかつ「sold_out」タグが付いている商品という指定をしたところ、売り切れ表示も出るようになりました。
{% if sold_out %}
{% for tag_product in product.tags %}
{% if tag_product contains 'coming_soon' %}
<div class="grid-product__sold-out comingsoon">
<p>coming soon</p>
</div>
{% elsif tag_product contains 'sold_out' %}
<div class="grid-product__sold-out">
<p>{{ 'products.product.sold_out_html' | t }}</p>
</div>
{% endif %}
{% endfor %}
{% elsif on_sale %}
<div class="grid-product__on-sale">
{% capture discount_percentage %}{{ product.compare_at_price | minus: product.price | times: 100 | divided_by: product.compare_at_price |round }}%{% endcapture %}
<p>{{ 'products.general.save_html' | t: saved_amount: discount_percentage }}</p>
</div>
{% endif %}
</div>
ただ、いちいち「sold_out」タグを付けるのも面倒なので、「coming_soon」タグが付いていない売り切れ商品には「売り切れ」表示が出るようにしたいのですが、
何か良い方法はございますでしょうか?
よろしくお願いいたします。
サポートの選択肢が増えていく中、最適となる選択の判断が難しくなっているかと存じます。今回は問題の解決に最適となるサポートの選択方法を、紹介させて頂きます。 選択肢のご紹介...
By Mirai Oct 6, 20242023年初頭、Shopifyペイメントアカウント、及びShopifyアカウント全体のセキュリティを強化する為の変更が適用されました。ユーザーのアカウントセキュリティを強化す...
By Mirai Sep 29, 2024概要: 年末/年明けは、消費者が最もショッピングを行う時期の一つです。特に、ブラックフライデー・サイバーマンデー(BFCM)は、世界中で注目される大規模なセールイベントであ...
By JapanGuru Sep 25, 2024