Tier pricing in Magento 2 allows you to offer discounts based on the quantity of items purchased. By displaying these tier prices directly on the category page, you can effectively communicate these discounts to your customers upfront, potentially increasing sales volume. This guide will walk you through the necessary steps to enable and display tier prices on the category page in Magento 2.
Step 1: Log in to Magento Admin Panel
- Access Magento Admin: Log in to your Magento 2 admin panel using your credentials.
Step 2: Enable Tier Pricing
-
Navigate to Product Settings: Go to
Stores
>Configuration
. -
Enable Tier Pricing: Under
Catalog
, selectCatalog
. -
Expand the
Catalog
section: Find thePrice
section and locate theCatalog Price Scope
setting. -
Set Scope to
Website
: Ensure that theCatalog Price Scope
is set toWebsite
. -
Save Configuration: Save your configuration changes.
Step 3: Modify Category Page Templates
-
Override Template Files: Override the default Magento 2 template files to customize the category page.
-
Create a Custom Module (Optional): For cleaner code management, consider creating a custom module.
Step 4: Display Tier Prices on Category Page
-
Edit
list.phtml
Template File: Locate thelist.phtml
file in your custom theme or module. -
Add PHP Code: Insert below PHP code to fetch and display tier prices for each product on the category page.
<?php
$_product = $block->getProduct();
$tierPrices = $_product->getTierPrice();
if (count($tierPrices) > 0):
foreach ($tierPrices as $tierPrice):
if ($tierPrice['price_qty'] > 1):
echo '<div class="tier-price">';
echo '<span class="qty">' . __('Buy %1 for', $tierPrice['price_qty']) . '</span>';
echo '<span class="price">' . $block->getPriceCurrency()->format($tierPrice['price']->getValue()) . '</span>';
echo '</div>';
endif;
endforeach;
endif;
?>
Customize CSS: Style the tier price display to match your theme's design.
Enabling tier pricing on the category page in Magento 2 enhances user experience by providing customers with valuable pricing information at a glance. By following these steps, you can effectively implement and display tier prices, potentially increasing conversion rates and customer satisfaction on your ecommerce store.