Merge pull request #8998 from toddlahman/master

Fix for Invalid argument supplied for foreach
This commit is contained in:
Mike Jolley 2015-08-31 12:22:39 +01:00
commit 591725874a
1 changed files with 5 additions and 3 deletions

View File

@ -239,9 +239,11 @@ class WC_Tax {
$rates = self::find_rates( $args );
$shipping_rates = array();
foreach ( $rates as $key => $rate ) {
if ( 'yes' === $rate['shipping'] ) {
$shipping_rates[ $key ] = $rate;
if ( is_array( $rates ) ) {
foreach ( $rates as $key => $rate ) {
if ( 'yes' === $rate['shipping'] ) {
$shipping_rates[ $key ] = $rate;
}
}
}