Description
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”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status