{"action":"created","issue":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/8140","labels_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8140/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8140/comments","events_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8140/events","html_url":"https://github.com/woothemes/woocommerce/issues/8140","id":75145333,"number":8140,"title":"[REST API] Loss of tax data when price_num_decimals is set to 0","user":{"login":"kallewallin","id":796502,"avatar_url":"https://avatars.githubusercontent.com/u/796502?v=3","gravatar_id":"","url":"https://api.github.com/users/kallewallin","html_url":"https://github.com/kallewallin","followers_url":"https://api.github.com/users/kallewallin/followers","following_url":"https://api.github.com/users/kallewallin/following{/other_user}","gists_url":"https://api.github.com/users/kallewallin/gists{/gist_id}","starred_url":"https://api.github.com/users/kallewallin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kallewallin/subscriptions","organizations_url":"https://api.github.com/users/kallewallin/orgs","repos_url":"https://api.github.com/users/kallewallin/repos","events_url":"https://api.github.com/users/kallewallin/events{/privacy}","received_events_url":"https://api.github.com/users/kallewallin/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-11T09:04:58Z","updated_at":"2015-06-02T06:01:26Z","closed_at":"2015-05-27T19:18:32Z","body":"I have here 3 order rows with data to explain the problem we are having.\r\n\r\nThe problem is mainly with total_tax that when price_num_decimals is set to 0 will be rounded. No other price fields are rounded and when we try to calculate taxrates, we get invalid rates.\r\n\r\nsubtotal_tax is not rounded, but as you can see on row nr 3 this value seem to only hold the original price and tax of the product. When the row price is changed as in row 3 from 19.20 to 100.0, then only total and total_tax is changed while subtotal and subtotal_tax remains with the original values(is that how it should be or is this a bug?)\r\n\r\n1. Should total_tax(and only total_tax) be rounded when price_num_decimals is 0?(or is this a bug?)\r\n\r\n2. It would also be nice if the taxrate was included on the order. An alternative would be the possability to fetch tax information via tax-class as a seperate resource in the api\r\n\r\n```\r\n{  \r\n   \"id\":27,\r\n   \"subtotal\":\"19.20\",\r\n   \"subtotal_tax\":\"2.30\",\r\n   \"total\":\"19.20\",\r\n   \"total_tax\":\"2.00\",\r\n   \"price\":\"19.20\",\r\n   \"quantity\":1,\r\n   \"tax_class\":\"class-1\",\r\n   \"name\":\"Vanlig 12\",\r\n   \"product_id\":182,\r\n   \"sku\":\"v12\",\r\n   \"meta\":[   ]\r\n},\r\n{  \r\n   \"id\":35,\r\n   \"subtotal\":\"57.59\",\r\n   \"subtotal_tax\":\"6.91\",\r\n   \"total\":\"57.59\",\r\n   \"total_tax\":\"7.00\",\r\n   \"price\":\"19.20\",\r\n   \"quantity\":3,\r\n   \"tax_class\":\"class-1\",\r\n   \"name\":\"Vanlig 12\",\r\n   \"product_id\":182,\r\n   \"sku\":\"v12\",\r\n   \"meta\":[   ]\r\n},\r\n{  \r\n   \"id\":38,\r\n   \"subtotal\":\"19.20\",\r\n   \"subtotal_tax\":\"2.30\",\r\n   \"total\":\"100.00\",\r\n   \"total_tax\":\"12.00\",\r\n   \"price\":\"100.00\",\r\n   \"quantity\":1,\r\n   \"tax_class\":\"class-1\",\r\n   \"name\":\"Vanlig 12\",\r\n   \"product_id\":182,\r\n   \"sku\":\"v12\",\r\n   \"meta\":[   ]\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/comments/107820617","html_url":"https://github.com/woothemes/woocommerce/issues/8140#issuecomment-107820617","issue_url":"https://api.github.com/repos/woothemes/woocommerce/issues/8140","id":107820617,"user":{"login":"kallewallin","id":796502,"avatar_url":"https://avatars.githubusercontent.com/u/796502?v=3","gravatar_id":"","url":"https://api.github.com/users/kallewallin","html_url":"https://github.com/kallewallin","followers_url":"https://api.github.com/users/kallewallin/followers","following_url":"https://api.github.com/users/kallewallin/following{/other_user}","gists_url":"https://api.github.com/users/kallewallin/gists{/gist_id}","starred_url":"https://api.github.com/users/kallewallin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kallewallin/subscriptions","organizations_url":"https://api.github.com/users/kallewallin/orgs","repos_url":"https://api.github.com/users/kallewallin/repos","events_url":"https://api.github.com/users/kallewallin/events{/privacy}","received_events_url":"https://api.github.com/users/kallewallin/received_events","type":"User","site_admin":false},"created_at":"2015-06-02T06:01:26Z","updated_at":"2015-06-02T06:01:26Z","body":"I just installed 2.3.10 which included: \"Fix - API - Fixed subtotal_tax round and decimal dp.\" which i guess is this one?\r\n\r\nThe problem we where having was that total_tax was rounded(ex 6.91 to 7.00), which is loss of data. In the new update both total_tax and subtotal_tax is rounded(when price_num_decimals is set to 0): \r\n\r\n```\r\n\"id\": 79,\r\n\"subtotal\": \"197.14\",\r\n\"subtotal_tax\": \"49.00\", (instead of 49.28)\r\n\"total\": \"197.14\",\r\n\"total_tax\": \"49.00\", (instead of 49.28)\r\n\"price\": \"98.57\",\r\n\"quantity\": 2,\r\n```\r\n\r\nShouldn't \"price_num_decimals\" just be a visual setting? The shop back-end seem to handle the data unrounded/unformated and only show the values rounded/foramtted in the front-end. So when we collect the data using the API we loose some tax data. It would be nice to always get the unrounded/unformated data or both"}}