cancel
Showing results for 
Search instead for 
Did you mean: 

simple pricing caclulation

SOLVED

simple pricing caclulation

Hi,

 

I am using Magento 2.4.

 

The product price is 12.95 and from 12 items there is a 10% discount.

My calculation is:

 

$priceHelper = $objectManager->create('Magento\Framework\Pricing\Helper\Data');
$priceHelper->currency(($price*12)-($price*12*0.1), true, false);

 

My result is therefore 139.86 (which seems correct to me) but the cart is showing me 139.92 after adding 12 products... 

 

So I have 2 questions:

 

- Is there any Magento functionality to get the final price for a given product, something like:

$finalPrice = $product->calculatePriceByQty($quantity);

 

- Why would the cart have this slightly different result? (I am not using any "Cart Price rule" or "Catalog Price Rule")

 

Thanks for any help or hint.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: simple pricing caclulation

Hello @jeromeclic79eb 

 

Your product price is 12.95 and after applying a 10% discount on it, the final price is 11.655.
 
In Magento, it takes the price as 11.66 therefore the calculation of this is 11.66*12 = 139.92 and price is 11.655*12 = 139.86
 
I hope it helps.
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

View solution in original post

2 REPLIES 2

Re: simple pricing caclulation

Hello @jeromeclic79eb 

 

Your product price is 12.95 and after applying a 10% discount on it, the final price is 11.655.
 
In Magento, it takes the price as 11.66 therefore the calculation of this is 11.66*12 = 139.92 and price is 11.655*12 = 139.86
 
I hope it helps.
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: simple pricing caclulation

Thanks so much Sanjay! Yes, this makes sense now. In all the coding I was not even considering this option...