shipping_methods can be null

This commit is contained in:
Mike Jolley 2016-06-07 14:24:10 +01:00
parent 30c4d3ab77
commit 5329baee0a
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,7 @@ class WC_Shipping {
/** @var bool True if shipping is enabled. */ /** @var bool True if shipping is enabled. */
public $enabled = false; public $enabled = false;
/** @var array Stores methods loaded into woocommerce. */ /** @var array|null Stores methods loaded into woocommerce. */
public $shipping_methods = null; public $shipping_methods = null;
/** @var float Stores the cost of shipping */ /** @var float Stores the cost of shipping */
@ -162,6 +162,9 @@ class WC_Shipping {
} }
$method = new $method(); $method = new $method();
} }
if ( is_null( $this->shipping_methods ) ) {
$this->shipping_methods = array();
}
$this->shipping_methods[ $method->id ] = $method; $this->shipping_methods[ $method->id ] = $method;
} }