{"id":306995,"date":"2021-09-26T10:19:23","date_gmt":"2021-09-26T10:19:23","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=306995"},"modified":"2024-07-24T07:53:05","modified_gmt":"2024-07-24T07:53:05","slug":"override-product-tier-prices-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/","title":{"rendered":"Override Product Tier Prices in Magento 2"},"content":{"rendered":"\n<p>Hello Friends!<br>In this blog, we will learn how we can override product&#8217;s tier prices on category product page and view product page.<\/p>\n\n\n\n<p><br>In Magento 2, to override the product&#8217;s tier prices, we have to create plugins and preference. So, please follow the below steps:<br><br><strong>1. Declare plugins and preferences:<\/strong> Here, we will declare required plugins and preferences in the di.xml file inside the app\/code\/Vendor\/CustomModule\/etc\/ directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?xml version=&quot;1.0&quot;?&gt;\n\n&lt;config xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:ObjectManager\/etc\/config.xsd&quot;&gt;\n\n  &lt;preference for=&quot;Magento\\Catalog\\Model\\Product\\Type\\Price&quot;  \n    type=&quot;Vendor\\CustomModule\\Rewrite\\Catalog\\Model\\Product\\Type\\Price&quot; \/&gt;\n\n  &lt;type name=&quot;Magento\\Catalog\\Pricing\\Price\\MinimalTierPriceCalculator&quot;&gt;\n        &lt;plugin name=&quot;tier_price_info&quot; \n          type=&quot;Vendor\\CustomModule\\Plugin\\Catalog\\Pricing\\Price\\MinimalTierPriceCalculator&quot; \n          sortOrder=&quot;999&quot; \n          disabled=&quot;false&quot;  \/&gt;\n  &lt;\/type&gt;\n\n  &lt;type name=&quot;Magento\\Catalog\\Pricing\\Price\\FinalPrice&quot;&gt;\n        &lt;plugin name=&quot;after_final_price_info&quot; \n          type=&quot;Vendor\\CustomModule\\Plugin\\Catalog\\Pricing\\Price\\ChangeTierPriceInfo&quot; \n          sortOrder=&quot;999&quot; \n          disabled=&quot;false&quot;  \/&gt;\n  &lt;\/type&gt;\n\n&lt;\/config&gt;<\/pre>\n\n\n\n<p><strong>2. Create preference class file Price.php for Magento\\Catalog\\Model\\Product\\Type\\Price class inside the app\/code\/Vendor\/CustomModule\/Rewrite\/Catalog\/Model\/Product\/Type\/ directory. In preference class, we will override &#8216;getExistingPrices&#8217; method of Price Class.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Vendor Desc.\n * php version 7.3.*\n *\n * @category Vendor\n * @package Vendor_CustomModule\n * @author Vendor\n * @copyright Vendor (https:\/\/example.com)\n * @license https:\/\/example.com\/license.html\n *\/\ndeclare(strict_types=1);\n\nnamespace Vendor\\CustomModule\\Rewrite\\Catalog\\Model\\Product\\Type;\n\nuse Magento\\Catalog\\Model\\Product;\nuse Magento\\Customer\\Api\\GroupManagementInterface;\nuse Magento\\Framework\\Pricing\\PriceCurrencyInterface;\nuse Magento\\Store\\Model\\Store;\nuse Magento\\Catalog\\Api\\Data\\ProductTierPriceExtensionFactory;\nuse Magento\\Framework\\App\\ObjectManager;\nuse Magento\\Store\\Api\\Data\\WebsiteInterface;\nuse Magento\\Catalog\\Api\\Data\\ProductTierPriceInterfaceFactory;\n\n\/**\n * Product type price model\n *\/\nclass Price extends \\Magento\\Catalog\\Model\\Product\\Type\\Price\n{\n    \/**\n     * Product price cache tag\n     *\/\n    const CACHE_TAG = &#039;PRODUCT_PRICE&#039;;\n\n    \/**\n     * @var array\n     *\/\n    protected static $attributeCache = &#091;];\n\n    \/**\n     * Core event manager proxy\n     *\n     * @var \\Magento\\Framework\\Event\\ManagerInterface\n     *\/\n    protected $_eventManager;\n\n    \/**\n     * Customer session\n     *\n     * @var \\Magento\\Customer\\Model\\Session\n     *\/\n    protected $_customerSession;\n\n    \/**\n     * @var \\Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface\n     *\/\n    protected $_localeDate;\n\n    \/**\n     * Store manager\n     *\n     * @var \\Magento\\Store\\Model\\StoreManagerInterface\n     *\/\n    protected $_storeManager;\n\n    \/**\n     * Rule factory\n     *\n     * @var \\Magento\\CatalogRule\\Model\\ResourceModel\\RuleFactory\n     *\/\n    protected $_ruleFactory;\n\n    \/**\n     * @var PriceCurrencyInterface\n     *\/\n    protected $priceCurrency;\n\n    \/**\n     * @var GroupManagementInterface\n     *\/\n    protected $_groupManagement;\n\n    \/**\n     * @var \\Magento\\Catalog\\Api\\Data\\ProductTierPriceInterfaceFactory\n     *\/\n    protected $tierPriceFactory;\n\n    \/**\n     * @var \\Magento\\Framework\\App\\Config\\ScopeConfigInterface\n     *\/\n    protected $config;\n\n    \/**\n     * @var ProductTierPriceExtensionFactory\n     *\/\n    private $tierPriceExtensionFactory;\n\n    \/**\n     * Constructor\n     *\n     * @param \\Magento\\CatalogRule\\Model\\ResourceModel\\RuleFactory $ruleFactory\n     * @param \\Magento\\Store\\Model\\StoreManagerInterface $storeManager\n     * @param \\Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface $localeDate\n     * @param \\Magento\\Customer\\Model\\Session $customerSession\n     * @param \\Magento\\Framework\\Event\\ManagerInterface $eventManager\n     * @param PriceCurrencyInterface $priceCurrency\n     * @param GroupManagementInterface $groupManagement\n     * @param ProductTierPriceInterfaceFactory $tierPriceFactory\n     * @param \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $config\n     * @param ProductTierPriceExtensionFactory|null $tierPriceExtensionFactory\n     *\/\n    public function __construct(\n        \\Magento\\CatalogRule\\Model\\ResourceModel\\RuleFactory $ruleFactory,\n        \\Magento\\Store\\Model\\StoreManagerInterface $storeManager,\n        \\Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface $localeDate,\n        \\Magento\\Customer\\Model\\Session $customerSession,\n        \\Magento\\Framework\\Event\\ManagerInterface $eventManager,\n        PriceCurrencyInterface $priceCurrency,\n        GroupManagementInterface $groupManagement,\n        ProductTierPriceInterfaceFactory $tierPriceFactory,\n        \\Magento\\Framework\\App\\Config\\ScopeConfigInterface $config,\n        ProductTierPriceExtensionFactory $tierPriceExtensionFactory = null\n    ) {\n        parent::__construct(\n            $ruleFactory,\n            $storeManager,\n            $localeDate,\n            $customerSession,\n            $eventManager,\n            $priceCurrency,\n            $groupManagement,\n            $tierPriceFactory,\n            $config,\n            $tierPriceExtensionFactory\n        );\n    }\n    \n    \/**\n     * Gets the &#039;tier_price&#039; array from the product\n     *\n     * @param Product $product\n     * @param string $key\n     * @param bool $returnRawData\n     * @return array\n     *\/\n    protected function getExistingPrices($product, $key, $returnRawData = false)\n    {\n        $prices = $product-&gt;getData($key);\n        \n        if ($prices === null) {\n            $attribute = $product-&gt;getResource()-&gt;getAttribute($key);\n            if ($attribute) {\n                $attribute-&gt;getBackend()-&gt;afterLoad($product);\n                $prices = $product-&gt;getData($key);\n            }\n        }\n\n        if ($prices === null || !is_array($prices)) {\n            return ($returnRawData ? $prices : &#091;]);\n        }\n\n        if ($key == &#039;tier_price&#039; &amp;&amp; !empty($prices)) {\n            $prevTier = $product-&gt;getData($key);\n           \n            \/\/custom tier prices array\n            $result = &#091;\n                &#091;\n                    &quot;website_id&quot;=&gt;0,\n                    &quot;customer_group_id&quot;=&gt;32000,\n                    &quot;qty&quot;=&gt;2.0000,\n                    &quot;price_value_type&quot;=&gt;&#039;fixed&#039;,\n                    &#039;value&#039;=&gt;35.0000,\n                    &#039;store_id&#039;=&gt;1\n                ]\n            ];\n\n            $prevTiers = &#091;];\n            if (!empty($prevTier)) {\n                foreach ($prevTier as $prev) {\n                    $newKey = $prev&#091;&quot;website_id&quot;].&quot;-&quot;.\n                        $prev&#091;&quot;all_groups&quot;].&quot;-&quot;.\n                        $prev&#091;&quot;cust_group&quot;];\n                    $prevTiers&#091;$newKey] = $prev;\n                }\n            }\n            if (!empty($result)) {\n                foreach ($result as $tier) {\n                    $allGroup = ($tier&#091;&quot;customer_group_id&quot;] != &quot;32000&quot;)? &quot;0&quot; : &quot;1&quot;;\n                    $genKey = $tier&#091;&quot;website_id&quot;].&quot;-&quot;.$allGroup.&quot;-&quot;.\n                        $tier&#091;&quot;customer_group_id&quot;];\n                    \n                    if (array_key_exists($genKey, $prevTiers)) {\n                        $each = &#091;];\n                        $each&#091;&quot;price_id&quot;]   = $prevTiers&#091;$genKey]&#091;&quot;price_id&quot;] ?? 0;\n                        $each&#091;&quot;website_id&quot;] = $tier&#091;&quot;website_id&quot;]        ?? &quot;0&quot;;\n                        $each&#091;&quot;all_groups&quot;] = $allGroup                  ?? &quot;0&quot;;\n                        $each&#091;&quot;cust_group&quot;] = $tier&#091;&quot;customer_group_id&quot;] ?? &quot;0&quot;;\n                        $each&#091;&quot;price_qty&quot;]  = $tier&#091;&quot;qty&quot;]               ?? &quot;0&quot;;\n    \n                        $each&#091;&quot;percentage_value&quot;]=$prevTiers&#091;$genKey]&#091;\n                            &quot;percentage_value&quot;] ?? null;\n                        $each&#091;&quot;price&quot;]           = $prevTiers&#091;$genKey]&#091;&quot;price&quot;]\n                            ?? &quot;0&quot;;\n                        $each&#091;&quot;website_price&quot;] = $prevTiers&#091;$genKey]&#091;&quot;website_price&quot;]\n                            ?? &quot;0&quot;;\n    \n                        if ($tier&#091;&quot;price_value_type&quot;] == &quot;fixed&quot;) {\n                            $each&#091;&quot;percentage_value&quot;] = null;\n                            $each&#091;&quot;price&quot;]            = $tier&#091;&quot;value&quot;] ?? &quot;0&quot;;\n                            $each&#091;&quot;website_price&quot;]    = $tier&#091;&quot;value&quot;] ?? &quot;0&quot;;\n                        }\n                        if ($tier&#091;&quot;price_value_type&quot;] == &quot;percent&quot;) {\n                            $each&#091;&quot;percentage_value&quot;] = $tiers&#091;&quot;value&quot;]      ?? &quot;0&quot;;\n                            $each&#091;&quot;price&quot;] = $prevTiers&#091;$genKey]&#091;&quot;price&quot;] ?? &quot;0&quot;;\n                            $each&#091;&quot;website_price&quot;] = $prevTiers&#091;$genKey]&#091;\n                                &quot;website_price&quot;] ?? &quot;0&quot;;\n                        }\n                        $prices&#091;] = $each;\n                    }\n                }\n            }\n        }\n        \n        return $prices;\n    }\n}<\/pre>\n\n\n\n<p><strong>3. Create <strong>MinimalTierPriceCalculator<\/strong>.php file inside the app\/code\/Vendor\/CustomModule\/Plugin\/Catalog\/Pricing\/Price\/ directory. In this file, we will create &#8216;aroundGetValue&#8217; plugin method of &#8216;getValue&#8217; method of  Magento\\Catalog\\Pricing\\Price\\MinimalTierPriceCalculator class.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Vendor Desc.\n * php version 7.3.*\n *\n * @category  Vendor\n * @package   Vendor_CustomModule\n * @author    Vendor\n * @copyright Vendor (https:\/\/example.com)\n * @license   https:\/\/example.com\/license.html\n *\/\nnamespace Venodr\\CustomModule\\Plugin\\Catalog\\Pricing\\Price;\n\nuse Magento\\Framework\\Pricing\\SaleableInterface;\n\nclass MinimalTierPriceCalculator\n{\n    \/**\n     * Get raw value of &quot;as low as&quot; as a minimal among tier prices{@inheritdoc}\n     *\n     * @param \\Magento\\Catalog\\Pricing\\Price\\MinimalTierPriceCalculator $subject\n     * @param \\Closure $proceed\n     * @param SaleableInterface $saleableItem\n     *\n     * @return float|null\n     *\/\n    \n    public function aroundGetValue(\n        \\Magento\\Catalog\\Pricing\\Price\\MinimalTierPriceCalculator $subject,\n        \\Closure $proceed,\n        SaleableInterface $saleableItem\n    ) {\n        $tierPrices        = &#091;];\n        $productTierPrices = &#091;];\n        $productTierPrices = $saleableItem-&gt;getTierPrices();\n        \n        if (!empty($productTierPrices)) {\n            $result = &#091;\n                &#091;\n                    &quot;website_id&quot;=&gt;0,\n                    &quot;customer_group_id&quot;=&gt;32000,\n                    &quot;qty&quot;=&gt;2.0000,\n                    &quot;price_value_type&quot;=&gt;&#039;fixed&#039;,\n                    &#039;value&#039;=&gt;35.0000,\n                    &#039;store_id&#039;=&gt;1\n                ]\n            ];\n            if (!empty($result)) {\n                foreach ($result as $tier) {\n                    $tierPrices&#091;] = $tier&#091;&quot;value&quot;];\n                }\n                if (!empty($tierPrices)) {\n                    return $tierPrices ? min($tierPrices) : null;\n                }\n            }\n        }\n        \n        return $proceed($saleableItem);\n    }\n}<\/pre>\n\n\n\n<p><strong>4. Create ChangeTierPriceInfo.php file inside the app\/code\/Vendor\/CustomModule\/Plugin\/Catalog\/Pricing\/Price\/ directory. In this file, we will create &#8216;aroundGetValue&#8217; plugin method of &#8216;getValue&#8217; method of \\Magento\\Catalog\\Pricing\\Price\\FinalPrice Class.<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\/**\n * Vendor Desc.\n * php version 7.3.*\n *\n * @category  Vendor\n * @package   Vendor_CustomModule\n * @author    Vendor\n * @copyright Vendor (https:\/\/example.com)\n * @license   https:\/\/example.com\/license.html\n *\/\nnamespace Vendor\\CustomModule\\Plugin\\Catalog\\Pricing\\Price;\n\nuse Magento\\Framework\\Session\\SessionManagerInterface;\nuse Magento\\Framework\\Stdlib\\Cookie\\CookieMetadataFactory;\nuse Magento\\Framework\\Stdlib\\CookieManagerInterface;\n \nclass ChangeTierPriceInfo\n{\n    \/**\n     * @var \\Magento\\Catalog\\Model\\Product\n     *\/\n    protected $productModel;\n\n    \/**\n     * @var \\Magento\\Framework\\App\\RequestInterface\n     *\/\n    protected $request;\n\n    \/**\n     * Constructor\n     *\n     * @param \\Magento\\Catalog\\Model\\Product $productModel\n     * @param \\Magento\\Framework\\App\\RequestInterface $request\n     *\/\n    public function __construct(\n        \\Magento\\Catalog\\Model\\Product $productModel,\n        \\Magento\\Framework\\App\\RequestInterface $request\n    ) {\n        $this-&gt;request      = $request;\n        $this-&gt;productModel = $productModel;\n    }\n\n    \/**\n     * Get price value\n     *\n     * @param \\Magento\\Catalog\\Pricing\\Price\\FinalPrice $subject\n     * @param \\Closure $proceed\n     *\n     * @return void\n     *\/\n    public function aroundGetValue(\n        \\Magento\\Catalog\\Pricing\\Price\\FinalPrice $subject,\n        \\Closure $proceed\n    ) {\n        $finalTierPrice = &#091;];\n        \n        $productId = $this-&gt;request-&gt;getParam(&quot;id&quot;) ?? 0;\n        $product   = $this-&gt;productModel-&gt;load($productId);\n    \n        $productObj = $subject-&gt;getProduct();\n        $prevTier   = $productObj-&gt;getData(&quot;tier_price&quot;);\n        $prevTiers = &#091;];\n\n        if (!empty($prevTier)) {\n            foreach ($prevTier as $prev) {\n                $newKey = $prev&#091;&quot;website_id&quot;].&quot;-&quot;.$prev&#091;&quot;all_groups&quot;].\n                    &quot;-&quot;.$prev&#091;&quot;cust_group&quot;];\n                $prevTiers&#091;$newKey] = $prev;\n            }\n        }\n        \n        \/\/custom tier prices array\n        $result = &#091;\n            &#091;\n                &quot;website_id&quot;=&gt;0,\n                &quot;customer_group_id&quot;=&gt;32000,\n                &quot;qty&quot;=&gt;2.0000,\n                &quot;price_value_type&quot;=&gt;&#039;fixed&#039;,\n                &#039;value&#039;=&gt;35.0000,\n                &#039;store_id&#039;=&gt;1\n            ]\n        ];\n            \n        if (!empty($result)) {\n            foreach ($result as $tier) {\n                $allGroup = ($tier&#091;&quot;customer_group_id&quot;] != &quot;32000&quot;)? &quot;0&quot; : &quot;1&quot;;\n                $genKey = $tier&#091;&quot;website_id&quot;].&quot;-&quot;.$allGroup.&quot;-&quot;.\n                    $tier&#091;&quot;customer_group_id&quot;];\n                if (array_key_exists($genKey, $prevTiers)) {\n                    $each = &#091;];\n                    $each&#091;&quot;price_id&quot;]   = $prevTiers&#091;$genKey]&#091;&quot;price_id&quot;] ?? 0;\n                    $each&#091;&quot;website_id&quot;] = $tier&#091;&quot;website_id&quot;]        ?? &quot;0&quot;;\n                    $each&#091;&quot;all_groups&quot;] = $allGroup                  ?? &quot;0&quot;;\n                    $each&#091;&quot;cust_group&quot;] = $tier&#091;&quot;customer_group_id&quot;] ?? &quot;0&quot;;\n                    $each&#091;&quot;price_qty&quot;]  = $tier&#091;&quot;qty&quot;]               ?? &quot;0&quot;;\n\n                    $each&#091;&quot;percentage_value&quot;] = $prevTiers&#091;$genKey]&#091;\n                        &quot;percentage_value&quot;] ?? null;\n                    $each&#091;&quot;price&quot;] = $prevTiers&#091;$genKey]&#091;&quot;price&quot;] ?? &quot;0&quot;;\n                    $each&#091;&quot;website_price&quot;]    = $prevTiers&#091;$genKey]&#091;\n                        &quot;website_price&quot;] ?? &quot;0&quot;;\n\n                    if ($tier&#091;&quot;price_value_type&quot;] == &quot;fixed&quot;) {\n                        $each&#091;&quot;percentage_value&quot;] = null;\n                        $each&#091;&quot;price&quot;]            = $tier&#091;&quot;value&quot;] ?? &quot;0&quot;;\n                        $each&#091;&quot;website_price&quot;]    = $tier&#091;&quot;value&quot;] ?? &quot;0&quot;;\n                    }\n                    if ($tier&#091;&quot;price_value_type&quot;] == &quot;percent&quot;) {\n                        $each&#091;&quot;percentage_value&quot;] = $tiers&#091;&quot;value&quot;]   ?? &quot;0&quot;;\n                        $each&#091;&quot;price&quot;] = $prevTiers&#091;$genKey]&#091;&quot;price&quot;] ?? &quot;0&quot;;\n                        $each&#091;&quot;website_price&quot;]    = $prevTiers&#091;$genKey]&#091;\n                            &quot;website_price&quot;] ?? &quot;0&quot;;\n                    }\n                    $finalTierPrice&#091;] = $each;\n                }\n            }\n        }\n\n        \/\/set modified tier prices array in product data\n        if (!empty($productObj-&gt;getData(&#039;tier_price&#039;)) &amp;&amp; !empty($finalTierPrice)) {\n            $productObj-&gt;setData(&#039;tier_price&#039;, $finalTierPrice);\n        }\n        \n        return $proceed();\n    }\n}<\/pre>\n\n\n\n<p><strong>5. See the result in the following images.<\/strong> Here, we have created a product and set the tier price to $40 as displayed in the image. After overriding the tier price, It will display $35 as in the following image.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"614\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1200x614.png\" alt=\"tier1\" class=\"wp-image-307001\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1200x614.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-300x153.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-250x128.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-768x393.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1536x786.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1.png 1806w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Created product and set price $50<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"618\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier2-1200x618.png\" alt=\"tier2\" class=\"wp-image-307002\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier2-1200x618.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier2-300x154.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier2-250x129.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier2-768x395.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier2-1536x791.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier2.png 1809w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Added tier price<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"615\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result1-1200x615.png\" alt=\"result1\" class=\"wp-image-307003\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result1-1200x615.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result1-300x154.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result1-250x128.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result1-768x393.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result1-1536x787.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result1.png 1818w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Overridden Tier price on product page<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"624\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result2-1200x624.png\" alt=\"result2\" class=\"wp-image-307004\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result2-1200x624.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result2-300x156.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result2-250x130.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result2-768x399.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result2-1536x798.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/result2.png 1797w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><figcaption class=\"wp-element-caption\">Overridden Tier Price on category product page<\/figcaption><\/figure>\n\n\n\n<p>Hope this will be helpful. Thanks \ud83d\ude42<br><br><strong>Previous Blog: <\/strong><a href=\"https:\/\/webkul.com\/blog\/override-product-special-price-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Override Product Special Price in Magento 2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Friends!In this blog, we will learn how we can override product&#8217;s tier prices on category product page and view product page. In Magento 2, to override the product&#8217;s tier prices, we have to create plugins and preference. So, please follow the below steps: 1. Declare plugins and preferences: Here, we will declare required plugins <a href=\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":249,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9121],"tags":[12100,12103,12104,12102],"class_list":["post-306995","post","type-post","status-publish","format-standard","hentry","category-magento-2","tag-override-product-price","tag-override-tier-price","tag-product-tier-price","tag-tier-price"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Override Product Tier Prices in Magento 2 - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Override Product Tier Prices in Magento 2, how to override product tier prices in magento, product ties prices override\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Override Product Tier Prices in Magento 2 - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Override Product Tier Prices in Magento 2, how to override product tier prices in magento, product ties prices override\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-26T10:19:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-24T07:53:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1200x614.png\" \/>\n<meta name=\"author\" content=\"Khushboo Sahu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Khushboo Sahu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/\"},\"author\":{\"name\":\"Khushboo Sahu\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\"},\"headline\":\"Override Product Tier Prices in Magento 2\",\"datePublished\":\"2021-09-26T10:19:23+00:00\",\"dateModified\":\"2024-07-24T07:53:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/\"},\"wordCount\":252,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1200x614.png\",\"keywords\":[\"override product price\",\"override tier price\",\"product tier price\",\"tier price\"],\"articleSection\":[\"Magento 2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/\",\"name\":\"Override Product Tier Prices in Magento 2 - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1200x614.png\",\"datePublished\":\"2021-09-26T10:19:23+00:00\",\"dateModified\":\"2024-07-24T07:53:05+00:00\",\"description\":\"Override Product Tier Prices in Magento 2, how to override product tier prices in magento, product ties prices override\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1.png\",\"width\":1806,\"height\":924,\"caption\":\"tier1\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Override Product Tier Prices in Magento 2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca\",\"name\":\"Khushboo Sahu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Khushboo Sahu\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Override Product Tier Prices in Magento 2 - Webkul Blog","description":"Override Product Tier Prices in Magento 2, how to override product tier prices in magento, product ties prices override","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"Override Product Tier Prices in Magento 2 - Webkul Blog","og_description":"Override Product Tier Prices in Magento 2, how to override product tier prices in magento, product ties prices override","og_url":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2021-09-26T10:19:23+00:00","article_modified_time":"2024-07-24T07:53:05+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1200x614.png","type":"","width":"","height":""}],"author":"Khushboo Sahu","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Khushboo Sahu","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/"},"author":{"name":"Khushboo Sahu","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca"},"headline":"Override Product Tier Prices in Magento 2","datePublished":"2021-09-26T10:19:23+00:00","dateModified":"2024-07-24T07:53:05+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/"},"wordCount":252,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1200x614.png","keywords":["override product price","override tier price","product tier price","tier price"],"articleSection":["Magento 2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/","name":"Override Product Tier Prices in Magento 2 - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1-1200x614.png","datePublished":"2021-09-26T10:19:23+00:00","dateModified":"2024-07-24T07:53:05+00:00","description":"Override Product Tier Prices in Magento 2, how to override product tier prices in magento, product ties prices override","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/09\/tier1.png","width":1806,"height":924,"caption":"tier1"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/override-product-tier-prices-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Override Product Tier Prices in Magento 2"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/f94b8f53397bf85810761d76c98fadca","name":"Khushboo Sahu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cabac965df656d114e6bf340df07518c990eda03bb09265dbd5c17f1097adaae?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Khushboo Sahu"},"url":"https:\/\/webkul.com\/blog\/author\/khushboo-sahu062\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/306995","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/249"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=306995"}],"version-history":[{"count":7,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/306995\/revisions"}],"predecessor-version":[{"id":454389,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/306995\/revisions\/454389"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=306995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=306995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=306995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}