The tag prints the product's discount percentage if the product is on sale through a campaign.
Description
The discount percentage can be determined in two ways:
- If the product is priced according to the general discount percentage of the campaign, the campaign discount percentage will be shown.
- If the product has an individual discount price in the campaign, the discount percentage is determined by the difference between the product's selling price and list price.
The discount percentage of products with variations is displayed if it is the same for all variations of the product. If the discount percentage, on the other hand, varies by variation, the tag does not display anything by default. By using the mode
attribute, you can specify whether the smallest or largest discount percentage of the variations is printed in that case, or their range.
Syntax
{ProductDiscountPercent(
mode: string,
percentagesymbol: boolean
)}
Scope
Required scope: tuote
The required scope is always set in the following templates:
Templates |
---|
Single product template |
Product images |
Attribuutit
mode:
The attribute determines what kind of discount information is displayed if there are variations of the product with varying discount percentages. (Without the attribute, nothing is displayed.)
Allowed values:- min: the smallest discount percentage among the variations (e.g. At least 20%)
- max: the largest discount percentage among the variations (e.g. Up to 40%)
- range: range of discount percentages (e.g. 20% – 40%)
To attach a supplementary expression to the numerical value (such as At least or Up to), use the
before
orafter
attribute.percentagesymbol:
Determines whether a percentage sign is included after the numeric value.
Allowed values:true/false. The default value is false.
after/before:
By using the
after
andbefore
attributes you can define content that is output either after or before the tag's output.Allowed values:HTML and Interface markup.
E.g.
before:
'<p>Tämä merkkaus näkyy ennen tagin omaa sisältöä.</p>'after:
'<p>Tämä taas näkyy tagin oman sisällön jälkeen.</p>'
If the tag does not produce any content, neither the content of the
after
andbefore
attributes will be output.escape:
Adds an escape character before quotation marks in the output.
The attribute makes it easier to process the tag-produced content when using JavaScript.
Allowed values:true/false. The default value is false.
or:
Defines alternative content that is displayed if the tag itself does not produce any content.
Allowed values:HTML and Interface markup.
E.g.
or:
'Sisältöä ei löytynyt.'