WordPress.org

Forums

WooCommerce - excelling eCommerce
[resolved] Round issues on order-receive page and confirmation mail (9 posts)

  1. lamberbee
    Member
    Posted 11 months ago #

    I'm having round issue on the order-receive page and confirmation mail for the taxes.

    Hereby an exapmle to illustrate what exactly the problem is:
    http://lemit.be/wp-content/uploads/2014/06/purchase-example.png

    As you can see, all totals and everything is OK. There is also nothing wrong with the amounts in the back-end.

    But on the order-received page and in the confirmation mail, the numbers are shown rounded. Even the shown total is not correct.

    So where can I correct this? Where is the rounding handled in WooCommerce.

    Thank you,
    Lambert.

    https://wordpress.org/plugins/woocommerce/

  2. lamberbee
    Member
    Posted 11 months ago #

    Hello,

    An update on my part: been looking a bit further into this rounding issue. The problem also occurs in the back-end.

    Please look at this documentation I made:
    http://lemit.be/wp-content/uploads/2014/06/Woocommerce-rounding-issue-back-end.jpg

    I assume it's more or less the same behaviour ...
    Where does this come from? I want the correct numbers seen, on the order-received page and in the confirmation mail.

    Any help where this is located please?
    Thanks.

  3. lamberbee
    Member
    Posted 11 months ago #

    Coming closer now to the issue.

    I was told by an expert that Woocommerce never ever uses comma's in their database. Because the store is set-up with comma as a decimal seperator, I did some checking. Could be WC was expecting a point and show number incorrectly because there is a comma.

    I first thought that the prices of products were stored with a comma. (wp_posts and wp_postsmeta DB files) But it wasn't and as I tested, creating a new product the prices are saved with a point. So that's working correctly.

    But while examining the order details (wp_woocommerce_order_itemmeta DB file), I saw the values were saved with a comma, like 38,23 instead of 38.23

    Change these entries directly in the DB from comma to a point and the the prices are shown correctly on the checkout/order-received page.

    The question now is, why is a product saved with a point in the values and an order with a comma in the prices, tax and other values?

    Anyone?

  4. Agus MU
    Member
    Posted 11 months ago #

    you need to remember the differences between your price input and your "displayed" price.

    when adding/editing price in your product, do not use thousand separator and always use point for decimal separator. this is the safest way to do.

    for example: 2500.50

    this is the format that is used for your database.

    if you need comma for your decimal separator, this can be configured from WooCommerce - Settings - General page. This setting will be used to format your "displayed" price using wc_price function. You can changed the format anytime when you need it.

    So, 2500.50 (in database) = 2.500,50 (displayed) or 2,500.50 (displayed), depends on your settings

    Note: I tried to put 2500,50 when editing my product and later version of WooCommerce looks convert it to 2500.50, which is good.

  5. lamberbee
    Member
    Posted 11 months ago #

    Hello Agus,

    Thanks for you comments. Already some feedback:

    • Woocommerce is configured for comma as a decimal seperator.
    • Do not use the thousand seperator, correct. But it's not used, the prices are not that high. :-)
    • When I create a new product and give in a price 20,30 it gets saved in the database 20.30 This is OK.
      But in the order_itemmeta DB file, all prices, taxes are saved with a comma. That's not OK. Why is Woocommerce saving all the numbers (in a string because it's meta data) with a comma.

    I also used the hook woocommerce_get_price to manipulate the price. It affects the prices throughout the complete order process, but not on the checkout/order-received page. It seems like that step in the order proces is not using the standard.

    Main question now is, why are values (prices, taxes, ..) stored with a comma during the order proces. Where is the code doing this.

    Kind regards,
    Lamberbee.

  6. lamberbee
    Member
    Posted 10 months ago #

    hmmm, nobody?

  7. BokaLoka
    Member
    Posted 10 months ago #

    Hi there,

    I got exactly the same problem. I have searched the forums and Googled this problem many times. It seems as if the checkout/order-received got it's own will.

    I would like to know if there is any solution to this issue also.

    Good luck on solving this issue.

  8. lamberbee
    Member
    Posted 10 months ago #

    Today I got the confirmation of Woocommerce that there is a bug in their plugin WPEC convertor.

    Did you use that Woocommerce plugin?

    I got a fix for the convertor plugin but that doesn't solve the issue. Conversion is done.

  9. lamberbee
    Member
    Posted 10 months ago #

    Found the problem. WPEC convertor create products with a comma in the database. Once that was corrected, the orders were still saved with a comma. FYI: WC save all values like prices, tax, e.a. with a point, even if de decimal seperator a comma.

    It was due to another plugin, http://wordpress.org/support/plugin/flat-rate-per-countryregion-for-woocommerce

    Once disabled solved the problem.

Reply

You must log in to post.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic