Use get_children for comparison

This commit is contained in:
Mike Jolley 2017-04-06 19:47:22 +01:00
parent a7a896008c
commit 8f2287be12
1 changed files with 1 additions and 1 deletions

View File

@ -289,7 +289,7 @@ class WC_Product_Variable_Data_Store_CPT extends WC_Product_Data_Store_CPT imple
*/
public function child_is_in_stock( $product ) {
global $wpdb;
$children = $product->get_visible_children();
$children = $product->get_children();
$oufofstock_children = $children ? $wpdb->get_var( "SELECT COUNT( post_id ) FROM $wpdb->postmeta WHERE meta_key = '_stock_status' AND meta_value = 'outofstock' AND post_id IN ( " . implode( ',', array_map( 'absint', $children ) ) . " )" ) : 0;
return count( $children ) > $oufofstock_children;
}