Updated sync logic to exclude hidden and out of stock variations from the price display #5035

This commit is contained in:
Mike Jolley 2014-03-04 14:44:24 +00:00
parent 4ab4811c57
commit decfca94a4
1 changed files with 10 additions and 1 deletions

View File

@ -465,8 +465,17 @@ class WC_Product_Variable extends WC_Product {
foreach ( $children as $child ) {
$child_price = get_post_meta( $child, '_price', true );
if ( $child_price === '' )
if ( $child_price === '' ) {
continue;
}
if ( get_post_status( $child ) != 'publish' ) {
continue;
}
if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && "0" === get_post_meta( $child, '_stock', true ) ) {
continue;
}
if ( $child_price > $max_price ) {
$max_price = $child_price;