Skip to main content
added 264 characters in body
Source Link
Robert
  • 2.2k
  • 3
  • 37
  • 84

I'm use Magento 2.4 and I need to change the format of the final price. I need to add a class for decimals. I want to add some css style to the decimals in the price. For example decimals must be much smaller than other numbers in the price. How I can make my final price to be like this:

enter image description here

Thank you

EDIT

I'm found something maybe will help to find the solution much quick. How I can use this for example in the product list?

$first_amount = 29.95;
$my_array = explode(".", $first_amount);
echo $my_array[0];
echo $my_array[1];

also I found this solution, but the same I don't know how I can implement this for magento 2

$float        = 12.054;
$parts        = explode('.', (string)$float);
$whole_number = $parts[0];
$numerator    = trim($parts[1], '0');
$denominator  = pow(10, strlen(rtrim($parts[1], '0')));

I'm use Magento 2.4 and I need to change the format of the final price. I need to add a class for decimals. I want to add some css style to the decimals in the price. For example decimals must be much smaller than other numbers in the price. How I can make my final price to be like this:

enter image description here

Thank you

I'm use Magento 2.4 and I need to change the format of the final price. I need to add a class for decimals. I want to add some css style to the decimals in the price. For example decimals must be much smaller than other numbers in the price. How I can make my final price to be like this:

enter image description here

Thank you

EDIT

I'm found something maybe will help to find the solution much quick. How I can use this for example in the product list?

$first_amount = 29.95;
$my_array = explode(".", $first_amount);
echo $my_array[0];
echo $my_array[1];

also I found this solution, but the same I don't know how I can implement this for magento 2

$float        = 12.054;
$parts        = explode('.', (string)$float);
$whole_number = $parts[0];
$numerator    = trim($parts[1], '0');
$denominator  = pow(10, strlen(rtrim($parts[1], '0')));
Source Link
Robert
  • 2.2k
  • 3
  • 37
  • 84

Magento 2.4 - Add class for decimals in the price

I'm use Magento 2.4 and I need to change the format of the final price. I need to add a class for decimals. I want to add some css style to the decimals in the price. For example decimals must be much smaller than other numbers in the price. How I can make my final price to be like this:

enter image description here

Thank you