We have a mixture of products, some with specialPrice and some with Catalog Rules set.
I need to display the discounted % for all my products on my frontend.
We were using $_product->getSpecialPrice() to get the discounted price, but this fails for products which prices based on catalog rules.
Is it possible to get the Discounted prices based on the catalog rule or from the specialPrice ?
Yes you can use $_product->getFinalPrice()
.
Here is the difference in the three prices:
$regularPrice = number_format($_product->getPrice(), 2);
$discountedPrice = number_format($_product->getFinalPrice(), 2);
$specialPrice = number_format($_product->getSpecialPrice(), 2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With