Hiding All Prices on Your Magento Site
As an e-commerce business owner or developer, you may want to disable prices from being displayed publicly on your Magento site while still allowing customers to add products to their carts. This could be useful for subscription-based models, wholesale pricing tiers, or creating a “request a quote” system.
Understanding the Default Price Display
By default, Magento displays product prices in various places across the frontend:
- Product Detail Pages
- Category Listing Pages
- Shopping Cart Summary
- Order Totals on Checkout Page
- Invoice and Shipments for admin users
The product price is determined by the combination of base price, tiered pricing, special price, catalog rules, and tax calculations. Magento uses these to display the final sale price.
Disabling Prices with PHP Overrides
To disable prices globally without modifying core files, you can use a PHP override in your theme’s local code pool. This allows for cleaner code separation and easier upgrades compared to direct file overrings.
- Navigate to
app/design/frontend/{package}/{theme}/Magento_Catalog/templates/product/price/default.phtml - Open the file in your preferred IDE.
- Comment out or delete all PHP logic inside the
<div class="price-box">block:
<!-- <div class="price-box">
<span class="regular-price">
<?php if ($block->getExcludeTaxFromPrice()): ?>
<span class="price-label"><?= /* @escapeNotVerified */ $block->getExclTaxPriceLabel() ?></span>
<?php else: ?>
<span class="price-label"><?= /* @escapeNotVerified */ $block->getIncludeTaxPriceLabel() ?></span>
<?php endif; ?>
<?= /* @escapeNotVerified */ $block->getProduct()->getFinalPrice() ?>
</span>
...
</div> -->
- Save the file.
This will remove all price displays from the product detail pages and category listings across your site, leaving behind empty price-box divs.
Removing Prices from Cart and Checkout
For a complete solution, you’ll also need to hide prices in the cart summary and checkout process:
- Override
app/design/frontend/{package}/{theme}/Magento_Checkout/templates/summary/items.phtml - Comment out or remove all logic inside the
<div class="summary-item-price">block. - Repeat for
app/design/frontend/{package}/{theme}/Magento_Catalog/templates/product/price/default.phtmlin the checkout area.
Using jQuery to Hide Prices
If you prefer a JavaScript-based approach, you can use jQuery to hide prices on the frontend:
- Add this script to your theme’s
footer.phtmlfile or create a new static block with the script:
<script>
$(document).ready(function() {
$('.price-box').hide();
$('.summary-item-price').hide();
});
</script>
- Include jQuery library if not already present in your theme.
Conclusion
Disabling prices globally in Magento requires careful overrides of key template files, both for the catalog and checkout processes. Always ensure you have a backup before making changes and thoroughly test your solution across different browsers and devices.
Remember that this approach does not hide prices from admin users or search enginesâyou’ll need additional configuration to achieve complete price invisibility.
For more advanced pricing customizations in Magento, I recommend exploring the Laravel Company blog for detailed tutorials on implementing special pricing rules and extending the native price calculation logic.