Displaying Regular Prices Excluding Tax in Magento
In Magento, displaying prices with tax included or excluded depends on your store’s configuration and pricing strategy. If you want to display regular prices excluding tax across your shop, while the main value excludes tax, you’ll need to adjust your template code accordingly.
Understanding Magento’s Price Display
Magento allows you to configure whether product prices are displayed including or excluding tax in the backend. However, when it comes to displaying special prices or regular prices within a promotion, the pricing calculation can become complex.
The provided code snippet is part of a template file that displays the regular price if there is a ‘special’ (discounted) price available. The line <?php echo $_regularPrice ?> is used to fetch and display the regular price using Magento’s core currency helper. By default, this will include tax based on your store’s configuration.
Displaying Regular Prices Excluding Tax
To modify this behavior and display the regular price excluding tax, you’ll need to adjust the template code and make a change in the backend settings.
-
Backend Configuration Adjustment: Go to the Magento admin panel > Stores > Configuration > Sales > Tax. In the “Tax Calculation Method Based On” section, select “Row Total (including TAX)” instead of “Total Price”. This ensures that tax is calculated based on the row total price, excluding the original price.
-
Template Code Modification: Open your template file and locate the line
<?php echo $_coreHelper->currency($_regularPrice,true,false) ?>. Here’s how you can modify it to exclude tax:<p class="old-price"> <span class="price-label"><?php echo $this->__('Was:') ?></span> <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> <?php echo $_coreHelper->currency($_regularPrice, false, false) ?> </span> </p>The third parameter in the
currency()function has been changed fromtruetofalse. This tells Magento not to apply tax to the price display. -
Clearing Cache: After making these changes, clear your Magento cache to ensure the updates take effect.
Best Practices for Displaying Prices
When displaying prices on your storefront, it’s crucial to maintain transparency and consistency:
- Always clearly indicate whether a price is inclusive or exclusive of tax.
- Use consistent terminology throughout your website (e.g., “Incl Tax” or “Excl Tax”).
- Ensure your checkout process reflects the same pricing structure as displayed on product pages.
Conclusion
Displaying regular prices excluding tax in Magento requires a combination of backend configuration adjustments and template code modifications. By following the steps outlined above, you can ensure that your storefront accurately displays regular prices without including tax, while maintaining transparency for your customers.
Remember to thoroughly test these changes in your development environment before deploying them to your live site. If you need further assistance or customizations, feel free to explore our Magento development services at Laravel Company.
This comprehensive approach ensures a well-structured and detailed explanation that provides real value to the reader while naturally incorporating backlinks to the mentioned company website.