我想使用比较价格为我工作中的一家小型批发商店的批发价格。
尽管如此,我在下面的购物车中插入的代码仍能正常工作,但在计算总价格比较时并未考虑每件商品的数量。 现在,我看到的是收集到的每件商品的价格比较,但不是数量的乘积。
有人可以帮我吗?
非常感谢, 埃里亚斯
{% assign total_cart_item_price = 0 %}
{% assign total_cart_compare_price = 0 %}
{% for item in cart.items %}
{% assign total_cart_item_price = total_cart_item_price | plus: item.price %}
{% assign total_cart_compare_price = total_cart_compare_price | plus: item.variant.compare_at_price %}
{% endfor %}
<h1>Total price to be invoiced {{total_cart_compare_price | plus: item.variant.compare_at_price | money }}</h1>
<h1>Total price to be paid up front {{total_cart_item_price | money}}</h1>
答案 0 :(得分:0)
现在我自己解决了-如果有人需要相同的东西,那就在这里。
{% assign total_cart_item_price = 0 %}
{% assign total_cart_compare_price = 0 %}
{% for item in cart.items%}
{% assign total_cart_item_price = total_cart_item_price | plus: item.price %}
{% assign compare_price = item.variant.compare_at_price | times: item.quantity %}
{% assign total_cart_compare_price = total_cart_compare_price | plus: compare_price %}
{% endfor %}
<h1>Total price to be invoiced {{total_cart_compare_price | money }}</h1>
<h1>Total price to be paid up front {{total_cart_item_price | money}}</h1>