2016-09-20 24 views

回答

0

這是模板產品卡的價格目標{{product.price}}

"product": { 
    "price": { 
    "without_tax": {"formatted": "$150.00","value": 150}, 
    "rrp_without_tax": {"formatted": "$250.00","value": 250}, 
    "saved": {"formatted": "$100.00","value": 100}, 
    "tax_label": "Tax" 
    } 
} 

產品的有效價格是銷售價格。此銷售價格與「不含稅」屬性相關聯。常規價格然後顯示在名爲「non_sale_price_without_tax」的新屬性中。

"product": { 
    "price": { 
    "without_tax": {"formatted": "$123.00","value": 123}, 
    "non_sale_price_without_tax": {"formatted": "$150.00","value": 150}, 
    "rrp_without_tax": {"formatted": "$250.00","value": 250}, 
    "saved": {"formatted": "$127.00","value": 127}, 
    "tax_label": "Tax" 
    } 
} 

然後,您可以使用條件邏輯,知道這一點,做一些事情來表示銷售價格,如:

{{#if price.non_sale_price_without_tax}} 
    … display on-sale strikeout pricing 
{{/if}} 
+0

感謝這個 - 不幸的是我甚至不能得到任何產品,以顯示在所有(在嘗試之前就問過這個問題,因爲我認爲它比它容易)。我已經向前端添加了'products:',但{{#each products}} ... {{/ each}}'仍然不會返回任何內容。我錯過了什麼嗎? – mikeybeck

+0

根據商店的稅務設置,您可能需要使用不同的支票('non_sale_price_without_tax' vs'non_sale_price_with_tax')。 爲了確保覆蓋所有情況,我建議將if檢查更改爲: '''{{#或price.non_sale_price_without_tax price.non_sale_price_with_tax}} ...這裏的東西 {{/ or}}''' –

相關問題