Known Issues

Sum of SellingPrice values may differ from total product value minus the total discounts

Checkout
Open
Isadora Bombonatti
Isadora Bombonatti
Last updated
9/30/2019

Summary

The sum of the product's unit value with applied discount (sellingPrice property) may differ from the product's total value minus the total discount value.

This is because unit discount calculation is a distribution of the total discount between all items and their quantities, which can cause rounding problems. By summing values that have been rounded, the difference from the original total can be noticed.

Therefore, sellingPrice should be used as a reference, keeping the totalizers as the real value.

The occurrence is more frequent in stores that use less than 2 decimal places, when rounding is most used.

Simulation

Example of occurrence:

  • Cart containing 2 units of a product that costs $ 190;
  • Total product value is $ 380;
  • 25% discount;
  • Total discount value is $ 95;
  • Discounted unit value is $ 142.5;
  • If the store does not use decimal places, the final unit value will be $ 142.

In this scenario:

  • Total products = $ 380;
  • Total discounts = $ 95;
  • Order Total = $ 285.

However, the sum of the items' sale price, with the discount applied, is $ 284.

Workaround

There is currently no workaround available for this scenario.

Still got questions?
Ask the community
Find solutions and share ideas in VTEX's community.
Talk to our experts
Get in touch if you have something specific to ask about the platform.
  • PT
  • ES
VTEX website