• Resolved axelra82

    (@axelra82)


    I’m trying to find where the data is stored, in the database, for what currency was used on individual orders.

    I’m writing a PHP script calculating the total amount of all sales made with a specific coupon. But since values for other currencies are stored in their respective amount, this result is not very correct or useful.

    Ex. let’s say I accept SEK and EUR. The EUR value would be 5 while the SEK value is 48.89…
    So when summing up all sales with the _line_total and _line_tax from the woocommerce meta values, you would end up with incorrect data. So I need to check each sale first in my query and see what currency was used. So if EUR was used, multiply by 9.77 in this case. That way I would get a more accurate, and usable result.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello

    Woocs plugin only convert the price. And only the current currency is stored in the database.

    Store order data is functional woocommerce. Table wp_postmeta meta_key =_order_currency

    Thread Starter axelra82

    (@axelra82)

    I didn’t quite understand your initial answer because I was to busy working on a solution. However, reading it again I understand you are saying “there is no such data”. Then what is _woocs_order_rate. This seems to be the rate used to convert, doing a reversed calculation (i.e. divide rather then multiply) would return the original value… wouldn’t it?

    • This reply was modified 8 years, 2 months ago by axelra82.

    Hello

    The currency in which the order was made is stored the currency Table wp_postmeta meta_key =_order_currency

    Thread Starter axelra82

    (@axelra82)

    Yup, got it ?? My bad… been to stressed the last couple of days. Finding myself reading everything twice before it sinks in.
    This solved the issue of allowing different currencies (and converting back using the exact exchange rate used at the time of purchase).

    Will update the code on my original SO post for anyone wanting to use it.

    • This reply was modified 8 years, 2 months ago by axelra82. Reason: added link to original stackoverflow post for reference
    Plugin Author RealMag777

    (@realmag777)

    Hello

    Thank you for cooperation!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Where to find what currency was used for payment in database’ is closed to new replies.