{"id":1469,"date":"2020-12-18T14:24:59","date_gmt":"2020-12-18T14:24:59","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/get-product-price-including-tax-in-magento-2\/"},"modified":"2025-07-17T10:13:32","modified_gmt":"2025-07-17T04:43:32","slug":"get-product-price-including-tax-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/get-product-price-including-tax-in-magento-2\/","title":{"rendered":"How to Get Product Price Including Tax in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The default\u00a0Magento 2\u00a0displays the original product price as configured from the admin panel. It does not include the tax amount that a customer has to pay. Your customers might feel deceived to find out the tax amount only after going through the selection process and adding the product to the cart.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This makes it important to show the payable tax while they\u2019re still exploring the product on your Magento 2 store.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, when you are offering your Magento 2 store products on a third-party platform\/marketplace, say, Facebook store, the original product price is displayed. Now, if you want to display the price, including the tax, you need to programmatically fetch the product price with the tax amount added.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Or simply use the&nbsp;<a href=\"https:\/\/meetanshi.com\/magento-2-facebook-shop-integration.html\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 Facebook Shop Integration<\/a>&nbsp;extension to not worry about the below code and sell your Magento 2 store products on the Facebook shop!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For now, here\u2019s the solution to&nbsp;<em><strong>get product price including tax in Magento 2<\/strong><\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The solution to Get Product Price Including Tax in Magento 2:<\/h2>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?php\n\nnamespace Meetanshi\\Module\\Helper;\n\nuse Magento\\Framework\\App\\Helper\\AbstractHelper;\nuse Magento\\Framework\\App\\Helper\\Context;\nuse Magento\\Catalog\\Model\\Product;\nuse Magento\\Catalog\\Helper\\Data as TaxHelper;\n\nclass Data extends AbstractHelper\n{\n    protected $productModel;\n    protected $taxHelper;\n\n    public function __construct(\n        Context $context,\n        Product $productModel,\n        TaxHelper $taxHelper\n    )\n    {\n        $this->productModel = $productModel;\n        $this->taxHelper = $taxHelper;\n        parent::__construct($context);\n    }\n\n    public function getProductPrice($productId)\n    {\n        $product = $this->productModel->load($productId);\n        $price = $this->taxHelper->getTaxPrice($product, $product->getFinalPrice(), true);\n        return $price;\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it. This code will get the job done for you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, for good karma, do share the solution with Magento Community and other Magento developers. Thank you!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The default\u00a0Magento 2\u00a0displays the original product price as configured from the admin panel. It does not include the tax amount that a customer has to&#8230;<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1469","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1469"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1469\/revisions"}],"predecessor-version":[{"id":13917,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1469\/revisions\/13917"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}