{"action":"created","issue":{"url":"https://api.github.com/repos/woothemes/wc-api-php/issues/14","repository_url":"https://api.github.com/repos/woothemes/wc-api-php","labels_url":"https://api.github.com/repos/woothemes/wc-api-php/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/woothemes/wc-api-php/issues/14/comments","events_url":"https://api.github.com/repos/woothemes/wc-api-php/issues/14/events","html_url":"https://github.com/woothemes/wc-api-php/issues/14","id":143337872,"number":14,"title":"duplicated variations data and  images when update products","user":{"login":"apuestaya","id":11563358,"avatar_url":"https://avatars.githubusercontent.com/u/11563358?v=3","gravatar_id":"","url":"https://api.github.com/users/apuestaya","html_url":"https://github.com/apuestaya","followers_url":"https://api.github.com/users/apuestaya/followers","following_url":"https://api.github.com/users/apuestaya/following{/other_user}","gists_url":"https://api.github.com/users/apuestaya/gists{/gist_id}","starred_url":"https://api.github.com/users/apuestaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apuestaya/subscriptions","organizations_url":"https://api.github.com/users/apuestaya/orgs","repos_url":"https://api.github.com/users/apuestaya/repos","events_url":"https://api.github.com/users/apuestaya/events{/privacy}","received_events_url":"https://api.github.com/users/apuestaya/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-24T19:28:40Z","updated_at":"2016-03-25T11:24:04Z","closed_at":"2016-03-25T11:24:04Z","body":"Hi, all works great but if i try to update a product all variations data including images are doubling. to prevent data duplicated i created this function:\r\n```\r\npublic function reset_product_variations($product_id)\r\n{\r\n    global $wpdb;\r\n  $args = array(\r\n\t'post_parent' => $product_id,\r\n\t'post_type'   => 'product_variation', \r\n\t'numberposts' => -1,\r\n\t'post_status' => 'any' \r\n); \r\n$childrens = get_children( $args);\r\nif($childrens):\r\n    foreach($childrens as $product_variation):    \r\n     $wpdb->query(\"DELETE FROM {$wpdb->postmeta} WHERE post_id = \".$product_variation->ID);\r\n     wp_delete_post($product_variation->ID,true ); \r\n    endforeach;\r\n    \r\nendif;\r\n}\r\n```\r\n\r\nIs there a simple way to delete variations images before insert to look like an update?\r\nThank you"},"comment":{"url":"https://api.github.com/repos/woothemes/wc-api-php/issues/comments/201244870","html_url":"https://github.com/woothemes/wc-api-php/issues/14#issuecomment-201244870","issue_url":"https://api.github.com/repos/woothemes/wc-api-php/issues/14","id":201244870,"user":{"login":"claudiosmweb","id":1264099,"avatar_url":"https://avatars.githubusercontent.com/u/1264099?v=3","gravatar_id":"","url":"https://api.github.com/users/claudiosmweb","html_url":"https://github.com/claudiosmweb","followers_url":"https://api.github.com/users/claudiosmweb/followers","following_url":"https://api.github.com/users/claudiosmweb/following{/other_user}","gists_url":"https://api.github.com/users/claudiosmweb/gists{/gist_id}","starred_url":"https://api.github.com/users/claudiosmweb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/claudiosmweb/subscriptions","organizations_url":"https://api.github.com/users/claudiosmweb/orgs","repos_url":"https://api.github.com/users/claudiosmweb/repos","events_url":"https://api.github.com/users/claudiosmweb/events{/privacy}","received_events_url":"https://api.github.com/users/claudiosmweb/received_events","type":"User","site_admin":false},"created_at":"2016-03-25T11:24:04Z","updated_at":"2016-03-25T11:24:04Z","body":"Not an issue in this wrapper and fixed on master."}}