{"action":"opened","issue":{"url":"https://api.github.com/repos/AffiliateWP/AffiliateWP/issues/1189","repository_url":"https://api.github.com/repos/AffiliateWP/AffiliateWP","labels_url":"https://api.github.com/repos/AffiliateWP/AffiliateWP/issues/1189/labels{/name}","comments_url":"https://api.github.com/repos/AffiliateWP/AffiliateWP/issues/1189/comments","events_url":"https://api.github.com/repos/AffiliateWP/AffiliateWP/issues/1189/events","html_url":"https://github.com/AffiliateWP/AffiliateWP/issues/1189","id":146682097,"number":1189,"title":"Question : Get the generated sales amount by affiliate","user":{"login":"KuneStudio","id":190149,"avatar_url":"https://avatars.githubusercontent.com/u/190149?v=3","gravatar_id":"","url":"https://api.github.com/users/KuneStudio","html_url":"https://github.com/KuneStudio","followers_url":"https://api.github.com/users/KuneStudio/followers","following_url":"https://api.github.com/users/KuneStudio/following{/other_user}","gists_url":"https://api.github.com/users/KuneStudio/gists{/gist_id}","starred_url":"https://api.github.com/users/KuneStudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KuneStudio/subscriptions","organizations_url":"https://api.github.com/users/KuneStudio/orgs","repos_url":"https://api.github.com/users/KuneStudio/repos","events_url":"https://api.github.com/users/KuneStudio/events{/privacy}","received_events_url":"https://api.github.com/users/KuneStudio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-07T16:50:28Z","updated_at":"2016-04-07T16:50:28Z","closed_at":null,"body":"Hi,\r\n\r\nThis is more a question than anything.\r\nI'd like to know how much the affiliate has generated with his referrals. \r\nIs there a simple way to know that ? \r\n\r\nIf not, here is how I imagine a solution : \r\n1/ I had the generated amount to the custom data column.\r\n2/ I loop through the referrals to know the total amount. \r\n\r\nSo basically that would be : \r\n1/\r\n```\r\nadd_filter('affwp_insert_pending_referral', 'add_generated_amount');\r\n\r\nfunction add_generated_amount($args){\r\n    \r\n    $products = $args['products'];\r\n    if(!is_serialized( $products )) { $products = maybe_serialize($products); }\r\n    $total = 0;\r\n    foreach ($products as $product){\r\n      $product_object = get_the_product($product);\r\n      $total += $product_object->get_price();\r\n    }\r\n\r\n    $args['custom'] = $total;\r\n    return $args;\r\n}\r\n```\r\n\r\nAny advice ?\r\nThanks !\r\n"}}