Skip to content

Commit

Permalink
Tierprice can't save float percentage value #18651. Fixed invalid zer…
Browse files Browse the repository at this point in the history
…os trimming.
  • Loading branch information
novikor committed May 18, 2019
1 parent f8022f8 commit 53aff60
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/code/Magento/Catalog/Pricing/Render/PriceBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,16 @@ public function getCanDisplayQty(Product $product)
* Format percent
*
* @param float $percent
*
* @return string
*/
public function formatPercent(float $percent): string
{
return rtrim(number_format($percent, 2), '.0');
/*First rtrim - trim zeros. So, 10.00 -> 10.*/
/*Second rtrim - trim dot. So, 10. -> 10*/
return rtrim(
rtrim(number_format($percent, 2), '0'),
'.'
);
}
}

0 comments on commit 53aff60

Please sign in to comment.