ワインを販売していて、年齢確認を追加したく、以下のコードを作り、sections/main-cart-footer.liquidに入れました。
{% assign has_alcohol = false %}
{% for item in cart.items %}
{% for collection in item.product.collections %}
{% if collection.handle == ‘年齢確認商品(ワイン)’ %}
{% assign has_alcohol = true %}
{% break %}
{% endif %}
{% endfor %}
{% if has_alcohol %}
{% break %}
{% endif %}
{% endfor %}
{% if has_alcohol %}
年齢確認
20歳未満の飲酒は法律で禁止されています。20歳未満の方への酒類の販売はできません。生年月日を入力してください*
<input required class=“required” id=“birthdate” type=“date” name=“attributes[生年月日]” value=“{{ cart.attributes[“生年月日”] }}”>
年齢を入力してください*
<input required class=“required” id=“age” type=“number” name=“attributes[年齢]” min=“0” max=“120” value=“{{ cart.attributes[“年齢”] }}”>
{% else %}
チェックアウトへ進む {% endif %}しかし、フォームが表示されませんでした。
原因や他の方法などなど、教えていただけると助かります