Merge pull request #7908 from SiR-DanieL/patch-2

Conditions improvement
This commit is contained in:
Mike Jolley 2015-04-13 10:54:49 +01:00
commit 80b6c6ca3f
1 changed files with 8 additions and 6 deletions

View File

@ -1797,7 +1797,7 @@ class WC_Admin_Post_Types {
$child_product_variations = get_children( 'post_parent=' . $id . '&post_type=product_variation' ); $child_product_variations = get_children( 'post_parent=' . $id . '&post_type=product_variation' );
if ( $child_product_variations ) { if ( ! empty( $child_product_variations ) ) {
foreach ( $child_product_variations as $child ) { foreach ( $child_product_variations as $child ) {
wp_delete_post( $child->ID, true ); wp_delete_post( $child->ID, true );
} }
@ -1805,7 +1805,7 @@ class WC_Admin_Post_Types {
$child_products = get_children( 'post_parent=' . $id . '&post_type=product' ); $child_products = get_children( 'post_parent=' . $id . '&post_type=product' );
if ( $child_products ) { if ( ! empty( $child_products ) ) {
foreach ( $child_products as $child ) { foreach ( $child_products as $child ) {
$child_post = array(); $child_post = array();
$child_post['ID'] = $child->ID; $child_post['ID'] = $child->ID;
@ -1825,9 +1825,11 @@ class WC_Admin_Post_Types {
case 'shop_order' : case 'shop_order' :
$refunds = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = 'shop_order_refund' AND post_parent = %d", $id ) ); $refunds = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = 'shop_order_refund' AND post_parent = %d", $id ) );
if ( ! is_null( $refunds ) ) {
foreach ( $refunds as $refund ) { foreach ( $refunds as $refund ) {
wp_delete_post( $refund->ID, true ); wp_delete_post( $refund->ID, true );
} }
}
break; break;
} }
} }