Commit 4fd71b2f92 for woocommerce
commit 4fd71b2f926001e15caa471acfda51b46ac52658
Author: Mario Santos <34552881+SantosGuillamot@users.noreply.github.com>
Date: Thu Dec 11 09:31:17 2025 +0100
MiniCart: Fix price formatted with too many decimals (#62355)
* Round to correct number of decimals
* Add changefile(s) from automation for the following project(s): woocommerce
* Use `Math.round` instead of `toFixed`
---------
Co-authored-by: github-actions <github-actions@github.com>
diff --git a/plugins/woocommerce/changelog/62355-wooplug-5941-interactivity-api-mini-cart-price-formatted-with-too-many b/plugins/woocommerce/changelog/62355-wooplug-5941-interactivity-api-mini-cart-price-formatted-with-too-many
new file mode 100644
index 0000000000..cd723e64af
--- /dev/null
+++ b/plugins/woocommerce/changelog/62355-wooplug-5941-interactivity-api-mini-cart-price-formatted-with-too-many
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Fix minicart prices formatted with too many decimals
\ No newline at end of file
diff --git a/plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/iapi-frontend.ts b/plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/iapi-frontend.ts
index 86d3a81a08..f50befffd4 100644
--- a/plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/iapi-frontend.ts
+++ b/plugins/woocommerce/client/blocks/assets/js/blocks/mini-cart/iapi-frontend.ts
@@ -61,7 +61,11 @@ const scalePrice = ( {
price,
inputDecimals,
outputDecimals = 0,
-}: ScalePriceArgs ) => price * Math.pow( 10, outputDecimals - inputDecimals );
+}: ScalePriceArgs ) => {
+ const scaledPrice = price * Math.pow( 10, outputDecimals - inputDecimals );
+ // Remove extra decimals.
+ return Math.round( scaledPrice );
+};
// Inject style tags for badge styles based on background colors of the document.
setStyles();