Make sure we have number > 0 so all variations are not deleted

This commit is contained in:
Mike Jolley 2017-04-05 20:22:05 +01:00
parent a6080aa4a9
commit 0035afc5a0
1 changed files with 4 additions and 0 deletions

View File

@ -393,6 +393,10 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
* @param $force_delete False to trash.
*/
public function delete_variations( $product_id, $force_delete = false ) {
if ( ! is_numeric( $product_id ) || 0 <= $product_id ) {
return;
}
$variation_ids = wp_parse_id_list( get_posts( array(
'post_parent' => $product_id,
'post_type' => 'product_variation',