![](/img/trans.png)
[英]Using Porto theme 3.6.3 in Shopify how can I turn off add to cart on specific products?
[英]How can I iterate through the order array on Shopify?
是的你可以。
這是代碼:
{% for order in customer.orders %}
<tr>
<td>{{ order.name | link_to: order.customer_url }}</td>
<td>{{ order.created_at | date: format: 'short' }}</td>
<td>{{ order.financial_status_label }}</td>
<td>{{ order.fulfillment_status_label }}</td>
<td>{{ order.total_price | money }}</td>
</tr>
{% for line_item in order.line_items %}
<tr>
<td>{{ line_item.title | link_to: line_item.product.url }}</td>
<td>{{ line_item.sku }}</td>
<td>{{ line_item.price | money }}</td>
<td>{{ line_item.quantity }}</td>
<td>{{ line_item.quantity | times: line_item.price | money }}</td>
</tr>
{% endfor %}
{% endfor %}
您必須首先在帳戶頁面中循環客戶訂單: {% for order in customer.orders %}
之后,您必須循環每個訂單中的訂單項,因此您需要在訂單循環中進行另一個循環: {% for line_item in order.line_items %}
就是這樣,其余的就是其他輸出,例如sku,價格,數量,總計...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.