Magento 2 Price Display Glitch: Fixed Product Tax Disappears with Custom Options
Magento 2 Price Display Glitch: Fixed Product Tax Disappears with Custom Options
Accurate pricing is the bedrock of any successful e-commerce operation, especially on a robust platform like Magento 2 (Adobe Commerce and Open Source). However, a recent GitHub issue (#41818) has brought to light a critical bug where the Fixed Product Tax (FPT) unexpectedly vanishes from the displayed product price on the frontend. This specific glitch occurs under certain tax configurations and when custom options are involved, leading to incorrect price displays and potential customer confusion or compliance issues.
The Core Problem: FPT's Disappearing Act
The issue, reported on Magento 2.4-develop, details a scenario where the final product price initially includes the FPT in the HTML sent by the server. However, once the frontend price box JavaScript executes, the FPT component is dropped, resulting in a lower, incorrect price displayed to the customer. This is particularly problematic for merchants relying on FPT for specific product pricing strategies.
The bug manifests under a precise set of preconditions:
- Magento 2.4-develop environment.
- Stores > Configuration > Sales > Tax settings configured as:
- Tax Calculation Based On: Origin
- Catalog Prices: Including Tax
- Display Product Prices In Catalog: Excluding Tax
- Fixed Product Taxes > Enable FPT: Yes
- Fixed Product Taxes > Display Prices In Product Lists and Product View Page: Including FPT only
- A tax rule with a specific rate (e.g., 8.25%) applicable to the store origin.
- A Fixed Product Tax attribute added to the default attribute set.
The issue is triggered when a product with a price and special price also includes a drop-down custom option with a percent value (e.g., 10%) and a Fixed Product Tax set for a specific region. After selecting the custom option, the FPT component is lost from the displayed price.
Reproducing the Glitch
To illustrate the problem, consider a product with a base price of 108.25 and a special price of 64.95, with an FPT of 10.00. The expected behavior is that the price, after page load, would be 70.00 (60.00 base + 10.00 FPT), and with an option selected, 76.00 (66.00 base + 10.00 FPT). However, the actual result shows prices of 60.00 and 66.00 respectively, indicating the FPT has been dropped.
The detailed steps involve creating such a product, adding a custom option, setting the FPT, reindexing, clearing cache, and then observing the price on the product page as a guest after the scripts have run and an option is selected.
Broader Implications and Community Response
This bug highlights the intricate nature of Magento's pricing and tax calculation logic. The issue description even references related problems, such as #38800 and PR #41810, indicating that fixes for one tax-related display issue can sometimes impact others. The complexity underscores why thorough testing and understanding of Magento's core pricing mechanisms are crucial.
Encouragingly, the Magento community has already responded. A developer, mlparthtrivedi, has volunteered to work on this issue, going through the standard contributor team assignment process. While no immediate workaround is provided in the comments, the active engagement signifies that a fix is in progress. This collaborative effort is a testament to the strength of the Magento Open Source ecosystem.
Shopping Mover's Perspective
For merchants considering or undergoing a Magento migration, understanding such nuances in the platform's behavior is vital. Accurate price display directly impacts conversion rates, customer trust, and legal compliance. As e-commerce migration experts, we at Shopping Mover emphasize the importance of meticulous configuration and staying updated with the latest Magento patches. If your store utilizes Fixed Product Tax and custom options, monitoring this issue's resolution will be key to ensuring your pricing remains transparent and correct. For complex tax setups or during a platform migration, professional assistance can help navigate these challenges effectively.