{"action":"created","issue":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/9562","labels_url":"https://api.github.com/repos/woothemes/woocommerce/issues/9562/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/woocommerce/issues/9562/comments","events_url":"https://api.github.com/repos/woothemes/woocommerce/issues/9562/events","html_url":"https://github.com/woothemes/woocommerce/issues/9562","id":116160117,"number":9562,"title":"Customer meta _order_count and _money_spent not accurate","user":{"login":"roykho","id":2132595,"avatar_url":"https://avatars.githubusercontent.com/u/2132595?v=3","gravatar_id":"","url":"https://api.github.com/users/roykho","html_url":"https://github.com/roykho","followers_url":"https://api.github.com/users/roykho/followers","following_url":"https://api.github.com/users/roykho/following{/other_user}","gists_url":"https://api.github.com/users/roykho/gists{/gist_id}","starred_url":"https://api.github.com/users/roykho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roykho/subscriptions","organizations_url":"https://api.github.com/users/roykho/orgs","repos_url":"https://api.github.com/users/roykho/repos","events_url":"https://api.github.com/users/roykho/events{/privacy}","received_events_url":"https://api.github.com/users/roykho/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/woothemes/woocommerce/labels/Bug","name":"Bug","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-10T17:36:40Z","updated_at":"2015-11-18T10:59:56Z","closed_at":null,"body":"So currently when the order status changes to `completed`, the customer meta `_order_count` and `_money_spent` is updated with the number of orders placed and total amount spent as expected.\r\n\r\nHowever if the status is then changed from `completed` to any other status and then back to `completed`, those values are again increased which skews the accuracy.\r\n\r\nProposed change is to watch for order status changes and conditionally check for the status and increment/decrement accordingly so it stays accurate.\r\n\r\nIn addition, I think the status `processing` should also add to the value as that status essential means customer has already paid.  Currently it is only looking for `completed`.\r\n\r\nReported here https://wordpress.org/support/topic/user-metas-_money_spent-and-_order_count-bug?replies=3"},"comment":{"url":"https://api.github.com/repos/woothemes/woocommerce/issues/comments/157679044","html_url":"https://github.com/woothemes/woocommerce/issues/9562#issuecomment-157679044","issue_url":"https://api.github.com/repos/woothemes/woocommerce/issues/9562","id":157679044,"user":{"login":"mikejolley","id":90977,"avatar_url":"https://avatars.githubusercontent.com/u/90977?v=3","gravatar_id":"","url":"https://api.github.com/users/mikejolley","html_url":"https://github.com/mikejolley","followers_url":"https://api.github.com/users/mikejolley/followers","following_url":"https://api.github.com/users/mikejolley/following{/other_user}","gists_url":"https://api.github.com/users/mikejolley/gists{/gist_id}","starred_url":"https://api.github.com/users/mikejolley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikejolley/subscriptions","organizations_url":"https://api.github.com/users/mikejolley/orgs","repos_url":"https://api.github.com/users/mikejolley/repos","events_url":"https://api.github.com/users/mikejolley/events{/privacy}","received_events_url":"https://api.github.com/users/mikejolley/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T10:59:56Z","updated_at":"2015-11-18T10:59:56Z","body":"You'd have to clear it on save_post @roykho "}}