Fix notices when calling get_shipping_classes().
This commit is contained in:
parent
1f5bca4daa
commit
c1cd3f097c
|
@ -210,9 +210,9 @@ class WC_Shipping {
|
|||
*/
|
||||
public function get_shipping_classes() {
|
||||
if ( empty( $this->shipping_classes ) ) {
|
||||
$this->shipping_classes = ( $classes = get_terms( 'product_shipping_class', array( 'hide_empty' => '0' ) ) ) ? $classes : array();
|
||||
$classes = get_terms( 'product_shipping_class', array( 'hide_empty' => '0' ) );
|
||||
$this->shipping_classes = $classes && ! is_wp_error( $classes ) ? $classes : array();
|
||||
}
|
||||
|
||||
return $this->shipping_classes;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,13 +64,18 @@ $settings = array(
|
|||
)
|
||||
);
|
||||
|
||||
if ( WC()->shipping->get_shipping_classes() ) {
|
||||
$shipping_classes = WC()->shipping->get_shipping_classes();
|
||||
|
||||
if ( ! empty( $shipping_classes ) ) {
|
||||
$settings[ 'class_costs' ] = array(
|
||||
'title' => __( 'Shipping Class Costs', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'description' => sprintf( __( 'These costs can optionally be added based on the %sproduct shipping class%s.', 'woocommerce' ), '<a href="' . admin_url( 'edit-tags.php?taxonomy=product_shipping_class&post_type=product' ) . '">', '</a>' )
|
||||
);
|
||||
foreach ( WC()->shipping->get_shipping_classes() as $shipping_class ) {
|
||||
foreach ( $shipping_classes as $shipping_class ) {
|
||||
if ( ! isset( $shipping_class->slug ) ) {
|
||||
continue;
|
||||
}
|
||||
$settings[ 'class_cost_' . $shipping_class->slug ] = array(
|
||||
'title' => sprintf( __( '"%s" Shipping Class Cost', 'woocommerce' ), esc_html( $shipping_class->name ) ),
|
||||
'type' => 'text',
|
||||
|
|
|
@ -161,6 +161,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
|
||||
= 2.4.1 - 10/08/2015 =
|
||||
* Fix - Tweaked the 2.4 upgrade routine to disable refund emails during update.
|
||||
* Fix - Notices when calling get_shipping_classes().
|
||||
|
||||
= 2.4.0 - 10/08/2015 =
|
||||
* Feature - Onboarding/setup wizard for new users to handle basic store settings and installation.
|
||||
|
|
Loading…
Reference in New Issue