htdat / woo-viet

The repo for the WordPress plugin "Woo Viet - WooCommerce for Vietnam"
https://wordpress.org/plugins/woo-viet/
37 stars 22 forks source link

VND for PP Standard: wrong currency and gross (total) price in email confirmation #65

Closed htdat closed 5 years ago

htdat commented 5 years ago

From https://wordpress.org/support/topic/currency-not-converted-in-order-confirmation-mail/

How to replicate

htdat commented 5 years ago

Debug

Related commit https://github.com/htdat/woo-viet/commit/12649806c3012835410bb27b964ec9fea6cc08f6

In fact, the fix for https://github.com/htdat/woo-viet/issues/56 is creating this issue.

Trace

  1. https://github.com/woocommerce/woocommerce/blob/fdbdb5c73a6bf44bea794b7751b519e3a7914263/includes/class-wc-order.php#L361
  2. https://github.com/woocommerce/woocommerce/blob/12fbfa5677a66bb0b4bc1d7af2ec2bbbcdd9f13b/includes/emails/class-wc-email-customer-on-hold-order.php#L42-L44
htdat commented 5 years ago

Another idea is to hook into woocommerce_order_get_currency filter where valid_response is being run, which can be checked by using debug_backtrace().

https://github.com/woocommerce/woocommerce/blob/fdbdb5c73a6bf44bea794b7751b519e3a7914263/includes/abstracts/abstract-wc-data.php#L751

This is NOT feasible as debug_backtrace() can not be used in production env.

htdat commented 5 years ago

Fixed in #67