Предупреждение: array_keys () ожидает, что параметр 1 будет массивом, значение NULL указано в plugins \ woocommerce \ includes \ wc-cart-functions.php в строке 469 - PullRequest
0 голосов
/ 15 мая 2019

Я делаю несколько плагинов, связанных с доставкой. На странице оформления заказа выдает 3 предупреждения:

Предупреждение: array_keys () ожидает, что параметр 1 будет массивом, значение NULL указано в \ wp-content \ plugins \ woocommerce \ includes \ wc-cart-functions.php в строке 469

Предупреждение: array_keys () ожидает, что параметр 1 будет массивом, значение NULL указано в \ wp-content \ plugins \ woocommerce \ includes \ wc-cart-functions.php в строке 439

Предупреждение: current () ожидает, что параметр 1 будет массивом, значение NULL указано в \ wp-content \ plugins \ woocommerce \ includes \ wc-cart-functions.php в строке 440

Моя версия WooCommerce - 3.6.2, тема - Storefront v2.5.0, а версия WordPress - 5.2.

public function unishippers_freight_add_rate_arr($add_rate_arr)
{
    if(isset($add_rate_arr) && (!empty($add_rate_arr)) && (is_array($add_rate_arr))){  
        add_filter( 'woocommerce_package_rates' , array($this , 'en_sort_woocommerce_available_shipping_methods'), 10, 2 );
        $instore_pickup_local_devlivery_action = apply_filters('unishippers_freight_quotes_plans_suscription_and_features' , 'instore_pickup_local_devlivery');
        foreach ($add_rate_arr as $key => $rate) {
            if(isset($rate['cost']) && $rate['cost'] > 0)
            {    
                $rate['label'] = $this->set_label_in_quote($rate);
                if($this->web_service_inst->en_wd_origin_array['suppress_local_delivery'] == "1" && (!is_array($instore_pickup_local_devlivery_action)) && ($this->shipment_type != 'multiple'))
                {
                    $rate = apply_filters('suppress_local_delivery' , $rate , $this->web_service_inst->en_wd_origin_array , $this->package_plugin, $this->InstorPickupLocalDelivery);
                    if(!empty($rate))
                    { 
                        $this->add_rate($rate);
                        $this->woocommerce_package_rates = 1;
                    }
                }
                else
                {
                    $this->add_rate($rate);
                }
            }
        }
        (isset($this->quote_settings['own_freight']) && ($this->quote_settings['own_freight'] == "yes")) ? $this->add_rate($this->arrange_own_freight()) : "";
    }
}

Он должен отображать кавычки, но выдает ошибки в основных файлах WooCommerce.

...