- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2021
05:30 AM
02-25-2021
05:30 AM
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.
Solved! Go to Solution.
Labels:
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021
09:57 PM
03-02-2021
09:57 PM
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.
200+ Magento 2 Extensions for Enhanced Shopping Experience.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021
09:57 PM
03-02-2021
09:57 PM
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.
200+ Magento 2 Extensions for Enhanced Shopping Experience.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2021
01:00 AM
03-03-2021
01:00 AM
Re: simple pricing caclulation
Thanks so much Sanjay! Yes, this makes sense now. In all the coding I was not even considering this option...