HCL Commerce Enterprise

Action: Apply Rounding

Use this action in a price rule to round up prices so that they are more attractive to customers. For example, you can apply rounding to prices calculated in a price rule so that they all end with .99. Rounding is particularly useful in price rules that calculate new prices from existing price lists, since the calculated price might not look the way you want it to without rounding.

Place the Apply Rounding action as the last action on the path. The following price rule uses the Apply Rounding action to round prices marked down from a price list so that the prices end with either .49 or .99, whichever is closest:

Apply Rounding action in a price rule

Rounding for different currencies

When you set up the Apply Rounding action, you can choose the currencies that you want to round:
  • To round multiple currencies the same way, use a single Apply Rounding action on the price rule path. In the previous example, notice that both the CDN (Canadian dollar) and USD (U.S. dollar) currencies are rounded in the same action because both currencies are rounded in the same way.
  • To round multiple currencies differently, use multiple consecutive Apply Rounding actions on the price rule path. In the following example, the price rule path has an additional Apply Rounding action for JPY (Japanese yen) because this currency is not rounded the same way as the CDN (Canadian dollar) and USD (U.S. dollar) currencies:

Multiple Apply Rounding actions

For a given currency, you can have only one Apply Rounding action per path. In the previous example, for instance, do not add another Apply Rounding action that rounds USD.

Additional guidelines for using the Apply Rounding action

  • Place Apply Rounding actions as the last elements on the path, as shown in the previous examples.
  • If you nest a price rule in another price rule, any Apply Rounding actions in the nested rule are ignored. Only Apply Rounding actions in the in the top-level rule are applied.

Rounding pattern examples and their effects on prices

When you set up the Apply Rounding action, you must specify rounding patterns. The following tables give examples of rounding patterns you can use and how they affect some example prices. Your rounding pattern must use an asterisk (*) to represent:
  • The first number place to the left that you do not want to explicitly round.
  • Any number places to the right of the decimal point (or another number) that you do not want to explicitly round.

Do not use a rounding pattern that has more decimal places than your currency, or prices will not be rounded. For example, do not specify a rounding pattern of *.999 for U.S. dollars.

For the decimal mark, you must use a decimal point symbol (.) in the Rounding patterns table, even if your currency uses a different symbol for the decimal mark. For example, if your currency uses a comma (,) as a decimal mark, you must use the decimal point (.) instead in the Rounding patterns table. On the storefront, the correct symbol for your currency will be used.

Table 1. For currencies with two decimal places:

summary for complex table

If you want to... Type this in the Rounding patterns table... Example price before rounding Example price after rounding
Round up prices to end with .99 *.99 123.12 123.99
3.57 3.99
Round up prices to end with either .49 or .99 *.49*.99(on two separate rows) 123.12 123.49
3.57 3.99
Round up prices to end with .*9 *.*9 123.12 123.19
3.57 3.59
Round up prices to end with 9.99 *9.99 123.12 129.99
3.57 9.99
Round up prices to end with .97 *.97 123.12 123.97
555.98 556.97

Notice in this example that the rounding also affected the number to the left of the decimal place as a result of rounding up.

3.57 3.97
Table 2. For currencies with no decimal places:

summary for complex table

If you want to... Type this in the Rounding patterns table... Example price before rounding Example price after rounding
Round up prices to end with 0 *0 23,232 23,240
8,899 8,900

Notice in this example that the rounding affected three number places as a result of rounding up.

Round up prices to end with 90 *90 23,232 23,290
8,899 8,990

Notice in this example that the rounding also affected the hundreds digit as a result of rounding up.

Round up prices to end with either 50 or 90 *50*90(on two separate rows) 23,232 23,250
23,267 23,290
Round up prices to end with 900 *900 23,232 23,900
2,000 2,900
2,929 3,900

Notice in this example that the rounding also affected the thousands digit as a result of rounding up.

Table 3. For currencies with three decimal places:

summary for complex table

If you want to... Type this in the Rounding patterns table... Example price before rounding Example price after rounding
Round up prices to end with .999 *.999 123.123 123.999
3.577 3.999
Round up prices to end with either .449 or .999 *.449*.999(on two separate rows) 123.123 123.449
3.577 3.999