Product Discount
The product_discount
object describes a discount applied to a product.
Usage Example
{%- comment -%} Show product discount details {%- endcomment -%}
{% if product.discount_information %}
<div>
<strong>Discount:</strong>
{% if product.discount_information.is_percentage %}
{{ product.discount_information.amount }}% off
{% else %}
{{ product.discount_information.amount | money_with_currency }} off
{% endif %}
{% if product.discount_information.begins %}<br>Starts: {{ product.discount_information.begins | date: '%Y-%m-%d' }}{% endif %}
{% if product.discount_information.ends %}<br>Ends: {{ product.discount_information.ends | date: '%Y-%m-%d' }}{% endif %}
</div>
{% endif %}
Properties
amount
Returns the discount amount.
begins
Returns the start date if it is set.
ends
Returns the end date if it is set.
is_percentage
Returns true if discount is a percentage.
Last updated on