释放双眼,带上耳机,听听看~!
{% comment %} 计算购物车金额 {% endcomment %}
{%- assign calculated_total_price = 0 -%}
{%- for line_item in cart.items -%}
{%- if line_item.requires_shipping -%}
{%- assign calculated_total_price = calculated_total_price | plus: line_item.final_line_price -%}
{%- endif -%}
{%- endfor -%}
{%- assign total_cart_discount = 0 -%}
{%- for discount_application in cart.cart_level_discount_applications -%}
{%- assign total_cart_discount = total_cart_discount | plus: discount_application.total_allocated_amount -%}
{%- endfor -%}
{%- assign calculated_total_price = calculated_total_price | minus: total_cart_discount -%}
{% comment %} 计算购物车金额 {% endcomment %}
{% comment %} 写法与上面的一样 {% endcomment %}
{%- liquid
assign calculated_total_price = 0
for line_item in cart.items
if line_item.requires_shipping
assign calculated_total_price = calculated_total_price | plus: line_item.final_line_price
endif
endfor
# We have to remove the cart level discount from the calculated amount
assign total_cart_discount = 0
for discount_application in cart.cart_level_discount_applications
assign total_cart_discount = total_cart_discount | plus: discount_application.total_allocated_amount
endfor
assign calculated_total_price = calculated_total_price | minus: total_cart_discount
-%}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。