首页 > 解决方案 > 添加消息提醒“选择您的尺码” 添加到购物车之前 shopify

问题描述

如何在添加到购物车之前添加消息提醒“选择您的尺码”shopify

我目前的代码是

{% include 'sca_freegift_price' with product %}
<script type="text/javascript">
  var SPOCustom = {};
  SPOCustom.selectorPrefix = '.product_section ';
</script>

<!-- spurit_po-added -->
{% include 'spurit_po-product-snippet' %}
<!-- /spurit_po-added -->
{% include 'shappify-bdl-no-select' %}

<script type="text/javascript">
  var orig_array = new Object();
</script>

  <div class="columns-fluid" itemscope itemtype="http://data-vocabulary.org/Product" id="product-{{ product.id }}">

  <div class="section product_section clearfix">

    {% include 'product-detail-snippet' %}

    {% if settings.product_images_position == 'right' %}
      <div class="{% if settings.product_sidebar %}six{% else %}eight{% endif %} columns {% if product-images == blank %}{% if settings.product_images_position == 'left' %}alpha{% else %}omega{% endif %}{% endif %}">
        {% include 'product-images' %}
        {% include "social-buttons" with "product" %}
      </div>
    {% endif %}

    <script text="text/javascript">
     $(document).ready(function(){

       var cartAdd = {
         Name: {{ product.title|json }},
         ProductHandle: {{ product.handle | prepend: '"' | append: '"' }},
         ProducePrice: {{sca_price | money | prepend: '"' | append: '"'}},
         ProductID: {{ product.id|json }},
       {% for image in product.images %}
         Image{{ image.position}}: {{ image.src | product_img_url: 'medium'| prepend: '"http:' | append: '"' }},
       {% endfor %}
         Categories: {{ product.collections|map:'title'|json }}
       };
       function learnq(){
         _learnq.push(['track', 'Added to Cart', cartAdd]);
       }

       $("#add-to-cart").click(learnq);
    });

我正在编辑 product.liquid 文件,如果用户不选择尺寸,我需要显示消息警报“选择您的尺寸”,并且必须选择添加到购物车

标签: shopifyshopify-template

解决方案


推荐阅读