Display Pattern: Number
Summary
Ā
Calculate the discounted product price based on a number field for product price and another number field for discount percentage.
{% assign discount = data.corporateInformation.discountPercentage |Ā divided_by: 100Ā %}
{% assign discountValue = data.corporateInformation.productPrice | times: discount %}
{% assign discountPrice =Ā data.corporateInformation.productPrice | minus: discountValue %}
{% if data.data.corporateInformation.discountPercentage %}
Discount Price:Ā {{ discountPrice }}
{% endif %}
Setup in Picturepark
Layer: Corporate Information
Field: Product Price
Field: Discount Percentage
Field Value Access
data.corporateInformation.productPrice
You can use additional Liquid Filters to perform mathematical operations with number values.Ā
Use Case
A valid use case could be to calculate the discount price, either working with a fixed discount or another number field carrying the discount (ID: discountPercentage), shown in this example:Ā Ā
{% assign discount = data.corporateInformation.discountPercentage |Ā divided_by: 100Ā %}
{% assign discountValue = data.corporateInformation.productPrice | times: discount %}
{% assign discountPrice =Ā data.corporateInformation.productPrice | minus: discountValue %}
{% if data.data.corporateInformation.discountPercentage %}
Discount Price:Ā {{ discountPrice }}
{% endif %}
FotoWare Switzerland AG - CH-5033 Buchs - Switzerland
https://picturepark.com - support@picturepark.com
Ā© 2023 FotoWare Switzerland AG