{"id":1960,"date":"2022-04-25T12:00:29","date_gmt":"2022-04-25T10:00:29","guid":{"rendered":"https:\/\/www.wp-moon.com\/?p=1960"},"modified":"2022-04-25T14:31:15","modified_gmt":"2022-04-25T12:31:15","slug":"how-to-add-shipping-vat-into-woocommerce-programmatically","status":"publish","type":"post","link":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/","title":{"rendered":"How to add shipping VAT into WooCommerce programmatically"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When you use WooCommerce, you can update quite easily shipping costs and taxes for your different shipping costs with the back-office.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The problem is that in the front-office, customers don&#8217;t see <strong>any details<\/strong> about the <strong>tax of your shipping<\/strong> service when they are on the <strong>Cart page<\/strong> and <strong>Checkout page<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This code is quite simple and you can add it through a new plugin or into your functions.php into your WordPress theme.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is a code to add :<\/p>\n\n\n\n<iframe src=\"https:\/\/pastebin.com\/embed_iframe\/x7psyd4x\" style=\"border:none;width:100%;height: 800px\"><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\">The goal is simple: We rewrite the shipping part with the <strong>hook <\/strong><em>woocommerce_cart_shipping_method_full_label<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see, the <em>$label<\/em> value is replaced by a new one. The old one is now in a commentary. This new one includes <strong>the price with and without taxes<\/strong>. If you want to change how it is displayed, you have to update this line :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$label .= ': ' . wc_price( $method-&gt;cost ) . ' ('. wc_price( $method-&gt;cost + $method-&gt;get_shipping_tax() ) .' incl VAT)';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Your pages will look the same as below:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"541\" height=\"412\" src=\"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/vat-tax.jpg\" alt=\"WooCommerce Cart : Shipping vat and taxes\" class=\"wp-image-1963\" srcset=\"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/vat-tax.jpg 541w, https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/vat-tax-300x228.jpg 300w\" sizes=\"(max-width: 541px) 100vw, 541px\" \/><figcaption>This is how it is displayed into the cart page<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/vat-tax-checkout-1024x335.jpg\" alt=\"Woocommerce Checkout : Shipping vat and tax \" class=\"wp-image-1962\" width=\"1024\" height=\"335\" srcset=\"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/vat-tax-checkout-1024x335.jpg 1024w, https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/vat-tax-checkout-300x98.jpg 300w, https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/vat-tax-checkout-768x251.jpg 768w, https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/vat-tax-checkout.jpg 1123w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>This is how it is displayed into the checkout page<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">And it&#8217;s done, customers can now see VAT details about the shipping!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you use WooCommerce, you can update quite easily shipping costs and taxes for your different shipping costs with the back-office. The problem is that in the front-office, customers don&#8217;t see any details about the tax of your shipping service when they are on the Cart page and Checkout page. This code is quite simple &hellip; <a href=\"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">How to add shipping VAT into WooCommerce programmatically<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":1961,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[147],"tags":[104],"class_list":["post-1960","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-woocommerce-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Add Shipping VAT into WooCommerce Programmatically - WP Moon<\/title>\n<meta name=\"description\" content=\"Customers don&#039;t have any details about the tax of your shipping service when they are on the Cart and Checkout page. Here&#039;s how to fix it!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Add Shipping VAT into WooCommerce Programmatically - WP Moon\" \/>\n<meta property=\"og:description\" content=\"Customers don&#039;t have any details about the tax of your shipping service when they are on the Cart and Checkout page. Here&#039;s how to fix it!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Moon\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpmoonwebsite\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-25T10:00:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-25T12:31:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/woocommerce-vat.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"1200\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Alexandre G\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@alexgaboriau\" \/>\n<meta name=\"twitter:site\" content=\"@WPMoon4\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alexandre G\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Add Shipping VAT into WooCommerce Programmatically - WP Moon","description":"Customers don't have any details about the tax of your shipping service when they are on the Cart and Checkout page. Here's how to fix it!","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:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/","og_locale":"en_US","og_type":"article","og_title":"Add Shipping VAT into WooCommerce Programmatically - WP Moon","og_description":"Customers don't have any details about the tax of your shipping service when they are on the Cart and Checkout page. Here's how to fix it!","og_url":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/","og_site_name":"WP Moon","article_publisher":"https:\/\/www.facebook.com\/wpmoonwebsite","article_published_time":"2022-04-25T10:00:29+00:00","article_modified_time":"2022-04-25T12:31:15+00:00","og_image":[{"width":1600,"height":1200,"url":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/woocommerce-vat.jpg","type":"image\/jpeg"}],"author":"Alexandre G","twitter_card":"summary_large_image","twitter_creator":"@alexgaboriau","twitter_site":"@WPMoon4","twitter_misc":{"Written by":"Alexandre G","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/#article","isPartOf":{"@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/"},"author":{"name":"Alexandre G","@id":"https:\/\/www.wp-moon.com\/en\/#\/schema\/person\/72a64e6910977ec9e4b32fd8da54369d"},"headline":"How to add shipping VAT into WooCommerce programmatically","datePublished":"2022-04-25T10:00:29+00:00","dateModified":"2022-04-25T12:31:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/"},"wordCount":193,"commentCount":0,"publisher":{"@id":"https:\/\/www.wp-moon.com\/en\/#organization"},"image":{"@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/woocommerce-vat.jpg","keywords":["woocommerce"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/","url":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/","name":"Add Shipping VAT into WooCommerce Programmatically - WP Moon","isPartOf":{"@id":"https:\/\/www.wp-moon.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/#primaryimage"},"image":{"@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/woocommerce-vat.jpg","datePublished":"2022-04-25T10:00:29+00:00","dateModified":"2022-04-25T12:31:15+00:00","description":"Customers don't have any details about the tax of your shipping service when they are on the Cart and Checkout page. Here's how to fix it!","breadcrumb":{"@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/#primaryimage","url":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/woocommerce-vat.jpg","contentUrl":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2022\/04\/woocommerce-vat.jpg","width":1600,"height":1200,"caption":"woocommerce tax and vat"},{"@type":"BreadcrumbList","@id":"https:\/\/www.wp-moon.com\/en\/how-to-add-shipping-vat-into-woocommerce-programmatically\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.wp-moon.com\/en\/"},{"@type":"ListItem","position":2,"name":"Tutorials","item":"https:\/\/www.wp-moon.com\/en\/category\/tutorials\/"},{"@type":"ListItem","position":3,"name":"How to add shipping VAT into WooCommerce programmatically"}]},{"@type":"WebSite","@id":"https:\/\/www.wp-moon.com\/en\/#website","url":"https:\/\/www.wp-moon.com\/en\/","name":"WP Moon","description":"","publisher":{"@id":"https:\/\/www.wp-moon.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wp-moon.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.wp-moon.com\/en\/#organization","name":"WP Moon","url":"https:\/\/www.wp-moon.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wp-moon.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2020\/02\/logo.png","contentUrl":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2020\/02\/logo.png","width":290,"height":95,"caption":"WP Moon"},"image":{"@id":"https:\/\/www.wp-moon.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/wpmoonwebsite","https:\/\/x.com\/WPMoon4"]},{"@type":"Person","@id":"https:\/\/www.wp-moon.com\/en\/#\/schema\/person\/72a64e6910977ec9e4b32fd8da54369d","name":"Alexandre G","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2023\/09\/312419460_10229483707296045_2919774527885824513_n-100x100.jpg","url":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2023\/09\/312419460_10229483707296045_2919774527885824513_n-100x100.jpg","contentUrl":"https:\/\/www.wp-moon.com\/wp-content\/uploads\/2023\/09\/312419460_10229483707296045_2919774527885824513_n-100x100.jpg","caption":"Alexandre G"},"description":"Alexandre, Web Developer &amp; Website Editor. I've been using WordPress for over 10 years in my professional environment and on personal projects. I created WP Moon to teach you how to use this CMS, solve your problems and show you all the tricks.","sameAs":["https:\/\/www.croque-pixel.com\/","https:\/\/x.com\/alexgaboriau","https:\/\/www.youtube.com\/@wp_moon\/videos"],"url":"https:\/\/www.wp-moon.com\/en\/author\/wp-moon\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/posts\/1960","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/comments?post=1960"}],"version-history":[{"count":0,"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/posts\/1960\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/media\/1961"}],"wp:attachment":[{"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/media?parent=1960"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/categories?post=1960"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wp-moon.com\/en\/wp-json\/wp\/v2\/tags?post=1960"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}