Answers.Body: <p>It looks like there is currently a Github issue/feature request for this that is on the Commerce 3.0 milestone: <a href="https://github.com/craftcms/commerce/issues/695" rel="nofollow noreferrer">https://github.com/craftcms/commerce/issues/695</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-23T07:44:41.427Z
Answers.Text: Thanks for the update. Will implement some twig code to make sure it displays correctly in the meantime
Answers.UserDisplayName: Ant Cooper
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-23T02:57:41.973Z
Answers.LastActivityDate: 2019-10-23T02:57:41.973Z
Answers.UserDisplayName: Brad Bell
Body: <p>We have a site-wide sale on with 10% off products. On the category/detail page the commerceCurrency filter appears to round down, but when a customer adds an item to the basket, it's shown correctly as the rounded up price. Just had a complaint that it was 1p more than advertised (can you believe!).</p>
  
  <p>Weirdly it rounds up correctly on my dev machine, which is running Ubuntu Desktop. Both running 18.04 LTS and PHP 7.3 with the same packages installed.</p>
  
  <p>I have dug around the commerce/yii codebase and it's ultimately using the vendor/yiisoft/yii2/i18n/Formatter.php asCurrency() method.</p>
  
  <p>I can write my own macro/filter to correct this, but seems like a bug to me.</p>
  
  <p>e.g. Price £16.95, on Sale, £15.255.</p>
  
  <p><code>{{ product.defaultVariant.salePrice|commerceCurrency(cart.currency) }}</code></p>
  
  <p>Results in £15.25, but the value 15.26 is saved to commerce_lineitems and added to the cart.</p>
  
Tags: <plugin-craftcommerce2>
Title: Rounding down issue with commerceCurrency filter
ThreadText: # Rounding down issue with commerceCurrency filter
  
  (Asked by: username_0 on 2019-10-22)
  
  We have a site-wide sale on with 10% off products. On the category/detail page the commerceCurrency filter appears to round down, but when a customer adds an item to the basket, it's shown correctly as the rounded up price. Just had a complaint that it was 1p more than advertised (can you believe!).
  
  Weirdly it rounds up correctly on my dev machine, which is running Ubuntu Desktop. Both running 18.04 LTS and PHP 7.3 with the same packages installed.
  
  I have dug around the commerce/yii codebase and it's ultimately using the vendor/yiisoft/yii2/i18n/Formatter.php asCurrency() method.
  
  I can write my own macro/filter to correct this, but seems like a bug to me.
  
  e.g. Price £16.95, on Sale, £15.255.
  
  `{{ product.defaultVariant.salePrice|commerceCurrency(cart.currency) }}`
  
  Results in £15.25, but the value 15.26 is saved to commerce\_lineitems and added to the cart.
  
  **Tags:** plugin-craftcommerce2
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-10-23. Score: 0 | Accepted answer
  
  It looks like there is currently a Github issue/feature request for this that is on the Commerce 3.0 milestone: <https://github.com/craftcms/commerce/issues/695>
  
  > **Comments:**
  > **username_0**: Thanks for the update. Will implement some twig code to make sure it displays correctly in the meantime  
  
  ---
  
  