Skip to content

Price

The Price object represents a value of an item in a specific currency according to specific tax value.

classDiagram
  direction LR
  class Price{
    bool isZero
    float grossValue
    float netValue
    float taxValue
    string currency
    string formatGross
    string formatNet
    string formatTaxValue
    string formatTax
  }

It is possible to render the gross value of the price by rendering the object directly.

source
{{ price }}
output
99.99

Properties

Attribute name Type Description
isZero bool Indicates if the price is zero.
grossValue float The gross value of the price rounded to two decimal places by default.
netValue float The net value of the price rounded to two decimal places by default.
taxValue float The tax value of the price rounded to two decimal places by default. It is calculated as follows: price.taxValue = price.grossValue - price.netValue
currency string The currency iso code of the price.
tax null|float The tax percentage value.
formatGross string Formatted value of the gross price.
formatNet string Formatted value of the net price.
formatTaxValue string Formatted value of the tax value.
formatTax string Formatted value of the tax percentage.

Examples

isZero property

{% if not price.isZero %}
  {{ price.formatGross }}
{% endif %}
$99.99

grossValue property

{{ price.grossValue }}
99.99

netValue property

{{ price.netValue }}
81.29

taxValue property

{{ price.taxValue }}
18.7

currency property

{{ price.currency }}
USD

tax property

{{ price.tax }}
23

formatGross property

{{ price.formatGross }}
$99.99

formatNet property

{{ price.formatNet }}
$81.29

formatTaxValue property

{{ price.formatTaxValue }}
$18.70

formatTax property

{{ price.formatTax }}
23%