{"id":209,"date":"2016-08-27T02:00:41","date_gmt":"2016-08-27T02:00:41","guid":{"rendered":"https:\/\/wiki.samuelchopard.ch\/?p=209"},"modified":"2019-03-18T14:29:27","modified_gmt":"2019-03-18T13:29:27","slug":"round-vat-total-to-x0","status":"publish","type":"post","link":"https:\/\/samuelchopard.ch\/wiki\/library\/round-vat-total-to-x0\/","title":{"rendered":"Round VAT total to .X5"},"content":{"rendered":"<p><!--more--><\/p>\n<p>Add the following code to the functions.php of your child-theme (<a target=\"_blank\" href=\"https:\/\/samuelchopard.ch\/wiki\/2016\/05\/29\/download-blank-child-theme\/\" target=\"_blank\" rel=\"noopener noreferrer\">download a free blank child-theme here<\/a>).<\/p>\n<pre class=\"EnlighterJSRAW\">function euro_5cent_rounding( $in ) {\n    return round( $in \/ 5, 2 ) * 5;\n  }\n  add_filter( 'woocommerce_tax_round', 'euro_5cent_rounding' );\nfunction get_taxes_euro_5cent_rounding( $taxes ) {\nreturn array_map( 'euro_5cent_rounding', $taxes );\n}\nadd_filter( 'woocommerce_cart_get_taxes', 'get_taxes_euro_5cent_rounding' );<\/pre>\n<p>&nbsp;<br \/>\n<strong>Then, empty the WooCommerce caches in order to see the changes.<\/strong><\/p>\n<p>Source: <a target=\"_blank\" href=\"https:\/\/wordpress.org\/support\/topic\/round-vat-total-to-x0?replies=6#post-8357651\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/wordpress.org\/support\/topic\/round-vat-total-to-x0?replies=6#post-8357651<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"Add the following code to the functions.php of your child-theme (download a free blank child-theme here). function euro_5cent_rounding( $in ) [...]","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,8],"tags":[228,251,283,287,301,319],"class_list":["post-209","post","type-post","status-publish","format-standard","hentry","category-plugins","category-woocommerce","tag-price","tag-round","tag-sub-total","tag-tax","tag-total","tag-vat"],"_links":{"self":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/comments?post=209"}],"version-history":[{"count":1,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/209\/revisions"}],"predecessor-version":[{"id":54925,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/209\/revisions\/54925"}],"wp:attachment":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/media?parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/categories?post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/tags?post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}