Special prices not displayed in 2.4.8 due to hasSpecialPrice() method change in final_price.phtml template
Preconditions and environment
- Magento version: 2.4.8
- Upgrade path: Upgraded from Magento 2.4.6 or earlier
- Environment: Any (development, staging, production)
- Theme: Any theme using default Magento pricing templates
- Product type: All product types with special prices configured
- Special price configuration: Products with valid special prices set via Admin Panel > Catalog > Products > [Product] > Advanced Pricing
Steps to reproduce
- Upgrade Magento installation from 2.4.6 (or earlier) to 2.4.8
- Configure a product with a special price in Admin Panel:
- Go to Catalog > Products
- Edit any product
- Click "Advanced Pricing" under Price field
- Set a "Special Price" lower than the regular price
- Save the product
- View the product on category pages or product listing pages
- Observe the price display
Expected result
- Special price should be displayed prominently
- Regular price should be shown crossed out or with "Regular Price" label
- Both prices should be visible to indicate the discount to customers
Actual result
- Only the regular price is displayed
- Special price is not shown at all
- No visual indication of any discount or special offer
- The hasSpecialPrice() method returns false even when a valid special price exists
Additional information
Root cause analysis: The issue stems from changes made to the hasSpecialPrice() method in Magento 2.4.8. The method now uses a performance optimization with special_price_map for product listings, but this map is not properly initialized in many contexts, causing the method to return false even when products have valid special prices.
Code location:
- Affected template: vendor/magento/module-catalog/view/base/templates/product/price/final_price.phtml
- Affected method: hasSpecialPrice() in pricing render blocks
Temporary workaround:
Replace the hasSpecialPrice() check in templates with direct price comparison:
// Instead of: if ($block->hasSpecialPrice()) $displayRegularPrice = $priceModel->getAmount()->getValue(); $displayFinalPrice = $finalPriceModel->getAmount()->getValue(); if ($displayFinalPrice < $displayRegularPrice)
Impact:
- Critical business impact: Special prices/discounts not visible to customers
- Affects sales and marketing strategies
- Reduces conversion rates due to invisible promotions
Release note
Fixed: Special prices are now correctly displayed on product listing and category pages after the pricing performance optimization introduced in 2.4.8. The hasSpecialPrice() method now properly handles cases where the special_price_map is not initialized, ensuring consistent special price visibility across all store contexts.
Triage and priority
- [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @dstreit0106. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.
- For more details, review the Magento Contributor Assistant documentation.
- Add a comment to assign the issue:
@magento I am working on this - To learn more about issue processing workflow, refer to the Code Contributions.
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @dstreit0106,
Thank you for your report and collaboration.
We have reviewed the reported issue and attempted to reproduce it in the both latest 2.4-develop and 2.4.8 both instances.However, we were unable to replicate the issue on our end. Please find the attached screenshot for the reference.
Step to Reproduce
- Upgrade Magento installation from 2.4.6 (or earlier) to 2.4.8
- Configure a product with a special price in Admin Panel:
- Go to Catalog > Products
- Edit any product
- Click "Advanced Pricing" under Price field
- Set a "Special Price" lower than the regular price
- Save the product
- View the product on category pages or product listing pages
- Observe the price display
As we followed the precondition and steps we didn't encounter any issue,Kindly reverify the issue once from your side and let us know if we may have missing anything.
Hence we marking this issue as "Needs Update"
Thank You again!
Hi @engcom-November
I've noticed the same issue with the hasSpecialPrice() function returning FALSE when there's a Catalog Price Rule or Special Price for bundle products.
The file is located at vendor/magento/module-catalog/Pricing/Render/FinalPriceBox.php hasSpecialPrice() line 161.
Hello @mc-christian ,
Thank you for the confirmation.
We tried for the bundle product as well and We have reviewed the reported issue and attempted to reproduce it in the both latest 2.4-develop and 2.4.8 both instances.However, we were unable to replicate the issue on our end. Please find the attached screenshots for the reference.
Thank you!
Thanks for reviewing @engcom-November , you're right that we don't see an issue on the frontend.
I'll put it this way; previously the hasSpecialPrice() function would return TRUE when there's Catalog Price Rule or a Special Price for a bundle product (I'm talking about the function itself, you probably won't see on the frontend). However, now in 2.4.8 it returns FALSE.
The commit responsible for this change is: https://github.com/magento/magento2/commit/9a246c6954b2ba5900b19b19cc78fac0691bf1dd
I'm not sure if this is considered an issue/bug but I'm just letting you know.
Hi @engcom-November
I have the same issue with my site after upgrading from 2.4.7-p5 to 2.4.8.
The only difference is that, on my product page, the special price and the normal price are displayed correctly. On the catalog page, and in other display formats, such as main page blocks. grid blocks, list blocks, carousel blocks, the regular price, and special price showing the same
Hello @zedspeirs-main ,
Thank you for your report and collaboration.
We’ve reviewed the above comment in our latest 2.4 develop instance and were unable to reproduce the issue. For your reference, please find the attached screenshot.
Could you kindly try clearing your cache and check again on your end? Let us know if we might be missing anything.
Thanks again for your support!
@engcom-November the problem is that in your second picture the "regular price" should be also listed. this is not the case.
The problem is caused by the return value of the hasSpecialPrice-method as in the issue description mentioned.
Hi, I'm having the same problem. Is there a temporary solution?
Dear @engcom-November ,
Thank you for your reply.
I already set my site to the developer mode, and some cache has already been disabled to debug (attached sample pictures) I use the default Luma theme, all core extensions are up to date. Magento version 2.4.8-p1, PHP8.2
Cache config:
Catalog list view:
Catalog grid view:
And the product detail page (where showing fine the regular and special price)
Regards,
It happens because of passing store id instead of website id at magento/module-catalog/Block/Product/ListProduct.php line no 446 This happens only when the store ID is different from the website ID for your website.
Hello @zedspeirs-main ,
Hello,
Thank you for your report and collaboration.
We have re-verified the issue on both our latest 2.4 develop and 2.4.8-p1 instances. However, we were unable to reproduce the issue on either environment. For your reference, I’ve attached screenshots from both instances.
Could you please recheck on your end? Everything appears to be working as expected from our side. If there are any specific steps we might be missing to reproduce the issue, kindly let us know.
Additionally, I’ll coordinate with my internal team and ask them to verify the behavior from their end as well. We’ll keep you updated if any findings.
Thank you again for your continued support!
Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
- [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
- [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
- [ ] 3. Add
Area: XXXXXlabel to the ticket, indicating the functional areas it may be related to. - [ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! - [ ] 5. Add label
Issue: Confirmedonce verification is complete. - [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
The issue is reproducible if the store_id is diferent than the website_id, in class: vendor/magento/module-catalog/Block/Product/ListProduct.php line 448 magento set storeId, but in: vendor/magento/module-catalog/Pricing/Price/SpecialPriceBulkResolver.php line 79 wait for website_id:
this patch resolve the issue:
diff --git a/vendor/magento/module-catalog/Block/Product/ListProduct.php b/vendor/magento/module-catalog/Block/Product/ListProduct.php
--- a/vendor/magento/module-catalog/Block/Product/ListProduct.php
+++ b/vendor/magento/module-catalog/Block/Product/ListProduct.php (date 1752262512401)
@@ -445,7 +445,7 @@
if ($this->specialPriceMap === null) {
$this->specialPriceMap = $this->specialPriceBulkResolver->generateSpecialPriceMap(
- (int)$this->_storeManager->getStore()->getId(),
+ (int)$this->_storeManager->getStore()->getWebsiteId(),
$this->_getProductCollection()
);
}
Hi @engcom-November @engcom-Bravo ,
I tested the patch provided by @Conrado2011, and it successfully resolved the issue.
This means you need to create a new store view instead of using the default one to reproduce the issue, because both the default store_id and website_id are set to 1, which doesn't trigger the issue.
I can also confirm that if you have multiple stores the hasSpecialPrice() function in \Magento\Catalog\Pricing\Render\FinalPriceBox is broken and returns nothing/false when the storeId != the website ID.
I am not sure why you are looking up pricing from catalog_product_index_price which is keyed on websiteId by storeID.
@engcom-November @engcom-Bravo this is easily reproducible if you add another store
Hi @dstreit0106,
Thanks for your reporting and collaboration.
We have tried to reproduce the issue in Latest 2.4-develop instance and the issue is reproducible when we have multiple stores.Kindly refer the screenshots.
Hence Confirming the issue.
Thanks.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-15205 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
I can reproduce this. When the store ID is the same as the website ID, it works fine, but on other store views where the ID does not match the website ID, it does indeed go wrong.
I can also confirm that the patch from @Conrado2011 solves this problem 😄
Looks like Magento core-devs already fixed this in ACP2E-4100: Regular price is not visible, even though a special price is applied, I guess this will be released in Magento 2.4.9 next year?
I've tested this out myself, it indeed fixes this issue. So I guess we can close this issue now here?
@hostep Thanks for your Contribution!!.
Hi @dstreit0106,
As I can see this issue got fixed in the scope of the internal Jira ticket ACP2E-4100 by the internal team Related commits:https://github.com/search?q=repo%3Amagento%2Fmagento2+ACP2E-4100&type=commits
Based on the Jira ticket, the target version is 2.4.9-alpha3.
Thanks