{"id":106094,"date":"2017-12-25T11:39:56","date_gmt":"2017-12-25T11:39:56","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=106094"},"modified":"2021-07-16T14:28:23","modified_gmt":"2021-07-16T14:28:23","slug":"product-tax-calculation-magento","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/","title":{"rendered":"Product tax calculation in magento"},"content":{"rendered":"\n<p>Magento handles product tax calculation on its own. But there are times when we need manual tax calculation for our products.<\/p>\n\n\n\n<p><em>$_item-&gt;getTaxAmount()&nbsp;<\/em>gives us the tax amount applied on the product. But there is yet another way to calculate tax.<br><a href=\"https:\/\/webkul.com\/blog\/list-taxes-magento2\/\">Click here to list all taxes in magento 2<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Load your product<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">$productId = 10; \/\/ for example\n$_product = Mage::getModel('catalog\/product')-&gt;load($productId);<\/pre>\n\n\n\n<p>Next we will calculate the tax rate percent. But for that we will require customer address, store information and product tax class id.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">\/\/ product tax class id\n$tax_class_id = $_product-&gt;getTaxClassId(); \n\/\/store\n$store = Mage::app()-&gt;getStore(); \/\/store\n\/\/ address\n$customerAddressId = Mage::getSingleton('customer\/session')-&gt;getCustomer()-&gt;getDefaultShipping();\nif ($customerAddressId){\n    $address = Mage::getModel('customer\/address')-&gt;load($customerAddressId);\n}<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Get product tax percent<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">$taxCalculation = Mage::getModel('tax\/calculation');\n$request = $taxCalculation-&gt;getRateRequest($address, null, null, $store);\n$percent = $taxCalculation-&gt;getStoreRate($request-&gt;setProductClassId($tax_class_id), $store);<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Calculate product tax amount<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted brush:php\">\/\/ get product price including tax\n$price = Mage::helper('tax')-&gt;getPrice($_product, $_product-&gt;getFinalPrice());\n\n$tax_amount = round($price\/(100+$percent)*$percent,2);<\/pre>\n\n\n\n<p><em>$tax_amount<\/em> has been rounded upto 2 decimal places.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" width=\"300\" height=\"39\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-300x39.png\" alt=\"product tax\" class=\"wp-image-106097\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-300x39.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-250x33.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342.png 375w\" sizes=\"(max-width: 300px) 100vw, 300px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>Happy coding \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento handles product tax calculation on its own. But there are times when we need manual tax calculation for our products. $_item-&gt;getTaxAmount()&nbsp;gives us the tax amount applied on the product. But there is yet another way to calculate tax.Click here to list all taxes in magento 2 Load your product $productId = 10; \/\/ for <a href=\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":164,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,1],"tags":[5965,1041],"class_list":["post-106094","post","type-post","status-publish","format-standard","hentry","category-magento","category-uncategorized","tag-product-tax","tag-tax"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Product tax percent and tax calculation in magento<\/title>\n<meta name=\"description\" content=\"Magento handles product tax calculation on its own. But there are times when we need manual tax calculation for our products.\" \/>\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\/product-tax-calculation-magento\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Product tax percent and tax calculation in magento\" \/>\n<meta property=\"og:description\" content=\"Magento handles product tax calculation on its own. But there are times when we need manual tax calculation for our products.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/\" \/>\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=\"2017-12-25T11:39:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-07-16T14:28:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-300x39.png\" \/>\n<meta name=\"author\" content=\"Paul Dutta\" \/>\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=\"Paul Dutta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/\"},\"author\":{\"name\":\"Paul Dutta\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/41a945ef9d13b037b8483b2340ae6748\"},\"headline\":\"Product tax calculation in magento\",\"datePublished\":\"2017-12-25T11:39:56+00:00\",\"dateModified\":\"2021-07-16T14:28:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/\"},\"wordCount\":100,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-300x39.png\",\"keywords\":[\"product tax\",\"tax\"],\"articleSection\":[\"magento\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/\",\"url\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/\",\"name\":\"Product tax percent and tax calculation in magento\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-300x39.png\",\"datePublished\":\"2017-12-25T11:39:56+00:00\",\"dateModified\":\"2021-07-16T14:28:23+00:00\",\"description\":\"Magento handles product tax calculation on its own. But there are times when we need manual tax calculation for our products.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342.png\",\"width\":375,\"height\":49},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Product tax calculation in magento\"}]},{\"@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\/41a945ef9d13b037b8483b2340ae6748\",\"name\":\"Paul Dutta\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/57d5fe0b5f0a7db7ce6bf447f403ff0c10c3d2e234e4a8398a8fe1daa71888b2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/57d5fe0b5f0a7db7ce6bf447f403ff0c10c3d2e234e4a8398a8fe1daa71888b2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Paul Dutta\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/paul-dutta287\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Product tax percent and tax calculation in magento","description":"Magento handles product tax calculation on its own. But there are times when we need manual tax calculation for our products.","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\/product-tax-calculation-magento\/","og_locale":"en_US","og_type":"article","og_title":"Product tax percent and tax calculation in magento","og_description":"Magento handles product tax calculation on its own. But there are times when we need manual tax calculation for our products.","og_url":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2017-12-25T11:39:56+00:00","article_modified_time":"2021-07-16T14:28:23+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-300x39.png","type":"","width":"","height":""}],"author":"Paul Dutta","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Paul Dutta","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/"},"author":{"name":"Paul Dutta","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/41a945ef9d13b037b8483b2340ae6748"},"headline":"Product tax calculation in magento","datePublished":"2017-12-25T11:39:56+00:00","dateModified":"2021-07-16T14:28:23+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/"},"wordCount":100,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-300x39.png","keywords":["product tax","tax"],"articleSection":["magento"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/","url":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/","name":"Product tax percent and tax calculation in magento","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342-300x39.png","datePublished":"2017-12-25T11:39:56+00:00","dateModified":"2021-07-16T14:28:23+00:00","description":"Magento handles product tax calculation on its own. But there are times when we need manual tax calculation for our products.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2017\/12\/Screenshot_342.png","width":375,"height":49},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/product-tax-calculation-magento\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Product tax calculation in magento"}]},{"@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\/41a945ef9d13b037b8483b2340ae6748","name":"Paul Dutta","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/57d5fe0b5f0a7db7ce6bf447f403ff0c10c3d2e234e4a8398a8fe1daa71888b2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/57d5fe0b5f0a7db7ce6bf447f403ff0c10c3d2e234e4a8398a8fe1daa71888b2?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Paul Dutta"},"url":"https:\/\/webkul.com\/blog\/author\/paul-dutta287\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/106094","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\/164"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=106094"}],"version-history":[{"count":3,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/106094\/revisions"}],"predecessor-version":[{"id":296768,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/106094\/revisions\/296768"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=106094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=106094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=106094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}