简体   繁体   English

Rivets.js Cart.js Shopify 产品未删除/更新购物车

[英]Rivets.js Cart.js Shopify Product Not removing/updating on cart

I have a cart page that is using rivets.js, cart.js and uses shopify.我有一个使用 rivets.js、cart.js 并使用 shopify 的购物车页面。

My issue is none of the remove, qty increase/decrease buttons are working on the cart page.我的问题是购物车页面上没有删除、数量增加/减少按钮。

Below is the code that I'm using.下面是我正在使用的代码。 The display is working as expected.显示器按预期工作。 It shows the qty, price, item name, description etc.它显示数量、价格、商品名称、描述等。

<div data-cart-view="data-cart-view">

  <div class="cart-info cart-info--mobile">
  <div class="grid">
    <div class="grid__item one-third">

        <strong data-cart-render="item_count">{{ cart.items.size }}</strong>

      <small>recommendations</small>
    </div>
    <div class="grid__item one-third">
        <strong data-cart-render="item_count"></strong>
      <small>pills per pack</small>
    </div>
    <div class="grid__item one-third cart-total">
      <strong>$ <span rv-html="cart.total_price | customcurrency"></span></strong>
      <small>per month</small>
    </div>
  </div>

  </div>



  <div rv-each-item="cart.items" class="cart-item grid">
    {% include 'bold-cart-item' with item %}
    <ul class="hide">
      <li rv-each-property="item.propertyArray < properties"  rv-data-id="property.name" rv-data-name="property.value" class="property-counter"></li>
    </ul>
    <div class="grid__item one-sixth">
      <img rv-src="item.image | productImageSize '250x250'">
    </div>


    <span rv-html="index | plus 1"></span>

    <div class="grid__item five-sixths"> 
      <div class="grid">
        <div class="grid__item large--four-sixths two-thirds">
          <h3 rv-text="item.title"></h3>
          <div class="cart-quantity" rv-data-id="item.title">
            <a href="#" rv-data-cart-update="index | plus 1" rv-data-cart-quantity="item.quantity | minus 1">-</a>
            <div class="qty"><span class="num" rv-text="item.quantity"></span> <span class="tablet">tablet</span></div>
            <a href="#" rv-data-cart-update="index | plus 1" rv-data-cart-quantity="item.quantity | plus 1">+</a>

            <span class="dailydose">Suggested daily dose</span>
          </div>


          {{ bold_item_properties }}
          {{ bold_recurring_desc }}
          {{ bold_item_price }}
        </div>
        <div class="grid__item large--two-sixths one-third text-right">
          <div class="item-price">
            <div class="price">$<span rv-html="item.line_price | customcurrency"></span></div>
            {% comment %}<td rv-html="item.line_price | money Currency.currentCurrency"></td>{% endcomment %}
            <small>per month</small>
          </div>
          <a href="#" rv-data-cart-remove="index | plus 1"  class="item-remove">&times;</a>
        </div>
      </div>
    </div>
  </div>


<div class="cart-info cart-info--desktop">
  <div class="grid">
    <div class="grid__item one-third">
        {% comment %} <strong data-cart-render="item_count"></strong>{% endcomment %} 
      <strong>{{ cart.items.size }}</strong>
      <small>recommendations</small>
    </div>
    <div class="grid__item one-third">
        <strong data-cart-render="item_count"></strong>
      <small>pills per pack</small>
    </div>
    <div class="grid__item one-third cart-total">
      <strong>$<span rv-html="cart.total_price | customcurrency"></span></strong>
      <small>per month</small>
    </div>
  </div>

  </div>

  </div>

Any help is greatly appreciated.任何帮助是极大的赞赏。 It is also using Bold as the recurring subscription app.它还使用 Bold 作为定期订阅应用程序。

Thank you in advance.先感谢您。

I was facing the same issue, and couldn't figure out the solution.我遇到了同样的问题,无法找到解决方案。 I saw the console give an error saying that the ajax functions are not defined in the jQuery.我看到控制台给出了一个错误,说 ajax 函数没有在 jQuery 中定义。 Turns out I was using the slim version, which doesn't include the ajax stuff.原来我使用的是精简版,其中不包括 ajax 内容。

Opted in and used the regular minified version and now, both the remove button and the quantity selector seem to be working fine.选择并使用常规的缩小版本,现在,删除按钮和数量选择器似乎都可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM