# Discount Description Templates

TO READ THE DOCS FOR THE "DISCOUNTED PRICE" APP BLOCK, CLICK HERE.

Click the thumbnail above to watch our founder explain how to set up discount description templates.

You can customize the text our app displays beneath discounted prices. For example, you might want to let users know that they received a special discount for being a loyal customer.

The discount description is HTML, so you can add tags and styles to your liking.

You can also use variables, which are based on the discount calculations we did for each product. They will be automatically replaced with the corresponding text/number when the discount description is displayed on the page.

[discount_message]: The title of the applied discount, as it would appear in the customer's cart/checkout.

[regular_price]: The price of the product before any discounts were applied. By default, it will be formatted into the local currency.

[sale_price]: The price of the product after discounts were applied. By default, it will be formatted into the local currency.

[discount_amount]: The difference between the [regular_price] and the [sale_price]. By default, it will be formatted into the local currency. Example: $5.00 (or $5.00 USD if you have the Currency code enabled? option on).

[discount_percentage]: The difference between the [regular_price] and the [sale_price]. This number will be rounded automatically. By default, it will be formatted as a percentage. Example: 20%.

To gain more control over the display of the discount description, you can use filters, which work like Liquid filters, to transform variables, or control their formatting. You can also chain filters.

Filters only work with number variables.

Examples:

[sale_price | to_fixed:2]

[discount_amount | fractional_part | to_fixed:2]

integer_part: The whole part of the number (removes any decimals). Example: Turns $12.34 to 12

fractional_part: The fractional part of the number, without the decimal point (.). Example: Turns $12.34 to 34

ceil: Applies a mathematical ceiling operation to the number. Example: Turns 12.34 to 13.

floor: Applies a mathematical floor operation to the number. Example: Turns 12.34 to 12.

round: Applies a mathematical round operation to the number. Example: Turns 12.34 to 12, and 12.55 to 13.

money: Formats the number as a monetary amount (follows the "Currency code enabled?" setting from the Discounts Embed).

money_without_trailing_zeros: Formats the number as a monetary amount, like money, but strips trailing zeros, following the same rules as Liquid.

percentage: Formats the number as a percentage (by appending a %).

to_fixed:N: Formats the number by rounding the number to N places. Example: [sale_price | to_fixed:2] turns 12.3456 to 12.34.

zero_pad_start:N: Formats the number by adding leading 0 until the length is at least N characters. Example: zero_pad_start:3 turns 3 into 003

zero_pad_end:N: Formats the number by adding trailing 0 until the length is at least N characters. Example: zero_pad_start:3 turns 3 into 300

Savings: [discount_amount | round] (Displays savings as a monetary amount)

<b>[discount_percentage] off</b> for wholesale customers (Displays savings as a percentage)

(Advanced. Displays savings using a superscript for the decimal part)

We want to hear about your experience with our app! Leave a review on the Shopify App Store.

Click the thumbnail above to watch our founder explain how to set up discount description templates.

You can customize the text our app displays beneath discounted prices. For example, you might want to let users know that they received a special discount for being a loyal customer.

The discount description is HTML, so you can add tags and styles to your liking.

You can also use variables, which are based on the discount calculations we did for each product. They will be automatically replaced with the corresponding text/number when the discount description is displayed on the page.

## Available variables

### Text variables

[discount_message]: The title of the applied discount, as it would appear in the customer's cart/checkout.

### Number variables

[regular_price]: The price of the product before any discounts were applied. By default, it will be formatted into the local currency.

[sale_price]: The price of the product after discounts were applied. By default, it will be formatted into the local currency.

[discount_amount]: The difference between the [regular_price] and the [sale_price]. By default, it will be formatted into the local currency. Example: $5.00 (or $5.00 USD if you have the Currency code enabled? option on).

[discount_percentage]: The difference between the [regular_price] and the [sale_price]. This number will be rounded automatically. By default, it will be formatted as a percentage. Example: 20%.

## Filters

To gain more control over the display of the discount description, you can use filters, which work like Liquid filters, to transform variables, or control their formatting. You can also chain filters.

Filters only work with number variables.

Examples:

[sale_price | to_fixed:2]

[discount_amount | fractional_part | to_fixed:2]

## Available filters:

### Math filters

integer_part: The whole part of the number (removes any decimals). Example: Turns $12.34 to 12

fractional_part: The fractional part of the number, without the decimal point (.). Example: Turns $12.34 to 34

ceil: Applies a mathematical ceiling operation to the number. Example: Turns 12.34 to 13.

floor: Applies a mathematical floor operation to the number. Example: Turns 12.34 to 12.

round: Applies a mathematical round operation to the number. Example: Turns 12.34 to 12, and 12.55 to 13.

### Formatting filters

money: Formats the number as a monetary amount (follows the "Currency code enabled?" setting from the Discounts Embed).

money_without_trailing_zeros: Formats the number as a monetary amount, like money, but strips trailing zeros, following the same rules as Liquid.

percentage: Formats the number as a percentage (by appending a %).

to_fixed:N: Formats the number by rounding the number to N places. Example: [sale_price | to_fixed:2] turns 12.3456 to 12.34.

zero_pad_start:N: Formats the number by adding leading 0 until the length is at least N characters. Example: zero_pad_start:3 turns 3 into 003

zero_pad_end:N: Formats the number by adding trailing 0 until the length is at least N characters. Example: zero_pad_start:3 turns 3 into 300

## Examples

Savings: [discount_amount | round] (Displays savings as a monetary amount)

<b>[discount_percentage] off</b> for wholesale customers (Displays savings as a percentage)

## Advanced Examples

```
You save:
<span style="color: green; font-weight: bold">
$[discount_amount | integer_part]
<sup>[discount_amount | fractional_part | round | zero_pad_end:2]</sup>
</span>
!
```

(Advanced. Displays savings using a superscript for the decimal part)

## Have any feedback for us?

We want to hear about your experience with our app! Leave a review on the Shopify App Store.

Updated on: 03/11/2024

Thank you!