Automattic / woocommerce-subscriptions-core

Subscriptions core package for WooCommerce
Other
81 stars 29 forks source link

Hardcoded negative sign on currency formatting #509

Open tpaksu opened 10 months ago

tpaksu commented 10 months ago

I've encountered an issue when altering the formatting applied on negative values to match the user locale in https://github.com/Automattic/woocommerce-payments/issues/6700 and saw that the negative sign is hardcoded on HTML output for some amounts. This creates a problem for applying the multi currency overrides with hooks to wc_price function, as some locales such as nl_BE, no_NO put the negative sign when formatting negative amounts in the EUR currency, like € -100.00. To fix this, the negative amount must be provided to wc_price, so it can alter the format accordingly.

https://github.com/Automattic/woocommerce-subscriptions-core/blob/2d7e58db1c5ef772f0a89372497e228d3c73ffff/includes/wcs-cart-functions.php#L311

There might be other instances of this, but I could only find this one via code search.