From 14e89c69da2d4be0910b22a8853e1b7dcf173a83 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 26 May 2016 12:54:14 +0100 Subject: [PATCH] No need to count legacy separate @claudiosmweb --- includes/wc-core-functions.php | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index 114f1ba851e..44f9b842ee3 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -1311,19 +1311,11 @@ function wc_get_shipping_method_count( $include_legacy = false ) { $method_count = absint( $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}woocommerce_shipping_zone_methods" ) ); if ( $include_legacy ) { - // WooCommerce legacy methods. - $legacy_methods = array( 'flat_rate', 'free_shipping', 'international_delivery', 'local_delivery', 'local_pickup' ); - foreach ( $legacy_methods as $method ) { - $options = get_option( 'woocommerce_' . $method . '_settings' ); - if ( $options && isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) { - $method_count++; - } - } - - // Include only activated methods that don't support shipping zones. + // Count activated methods that don't support shipping zones. $methods = WC()->shipping->get_shipping_methods(); + foreach ( $methods as $method ) { - if ( ! $method->supports( 'shipping-zones' ) && isset( $method->enabled ) && 'yes' === $method->enabled ) { + if ( isset( $method->enabled ) && 'yes' === $method->enabled && ! $method->supports( 'shipping-zones' ) ) { $method_count++; } }