Skip to content

Commit 53aff60

Browse files
committed
Tierprice can't save float percentage value magento#18651. Fixed invalid zeros trimming.
1 parent f8022f8 commit 53aff60

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/code/Magento/Catalog/Pricing/Render/PriceBox.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,16 @@ public function getCanDisplayQty(Product $product)
102102
* Format percent
103103
*
104104
* @param float $percent
105+
*
105106
* @return string
106107
*/
107108
public function formatPercent(float $percent): string
108109
{
109-
return rtrim(number_format($percent, 2), '.0');
110+
/*First rtrim - trim zeros. So, 10.00 -> 10.*/
111+
/*Second rtrim - trim dot. So, 10. -> 10*/
112+
return rtrim(
113+
rtrim(number_format($percent, 2), '0'),
114+
'.'
115+
);
110116
}
111117
}

0 commit comments

Comments
 (0)