kkarpieszuk / wc-price-history

Track Woocommerce Products prices history and display the lowest price in the last 30 days. This plugin allows your WC shop to be compliant with European Commision Directive 98/6/EC Article 6a which specyfies price reduction annoucment policy.
MIT License
6 stars 4 forks source link

Wrong number of decimals when displaying the lowest price #36

Closed mziab closed 1 year ago

mziab commented 1 year ago

The lowest price is displayed in the format of 77,2zł instead of 77,20zł. That's with the number of decimals in the WooCommerce currency settings set to 2. The currency settings, including decimals, seem to be ignored. For the record, this is using the shortcode, but this seems like a more general bug with regards as to how prices are displayed.

Expected behavior: The price is displayed according to WooCommerce currency settings.

Relevant package versions: WooCommerce 7.3.0 WC Price History 1.6.4

kkarpieszuk commented 1 year ago

Thank you for the next good finding. I fixed it and merged into develop, but this time I will not be rushing with the release ;)

The change is small so if you are familiar with code you can apply it on your current version if you need it now: https://github.com/kkarpieszuk/wc-price-history/pull/37/files

mziab commented 1 year ago

@kkarpieszuk This fix is problematic in that wc_price also adds the currency symbol (along with some extra markup, but that's mostly harmless), so we're left with duplicate currency symbols like this: <span class="woocommerce-Price-amount amount"><bdi>49,00<span class="woocommerce-Price-currencySymbol">zł</span></bdi></span>zł

kkarpieszuk commented 1 year ago

then good I didn't release it :) thank you again for the check

here is a new commit which fixed this with respect for currency code https://github.com/kkarpieszuk/wc-price-history/commit/018a4dae95e4a2fa4fbfb36c6cb0592f3bb77d20

mziab commented 1 year ago

@kkarpieszuk I can confirm this gives me the right format.

kkarpieszuk commented 1 year ago

1.6.5 with that fix has been released