WooCommerce account side package rates null

梦想的初衷 提交于 2021-01-29 14:18:28

问题


I have been trying to alter shipping rates to a flat fee for a language. This seems fine by simply adding a hook to the woocommerce_package_rates.

However I am now getting multiple fatal errors when trying to access the account area and the basket. They start with the error below and all seem to be triggered from the $package['rates'] array which it doesn't seem to like.

Warning: array_keys() expects parameter 1 to be array, null given in /home/..../....../wp-content/plugins/woocommerce/includes/wc-cart-functions.php on line 468

This is line 464-468, $new_rates throws the error.

function wc_shipping_methods_have_changed( $key, $package ) {
// Lookup previous methods from session.
$previous_shipping_methods = WC()->session->get( 'previous_shipping_methods' );
// Get new and old rates.
$new_rates  = array_keys( $package['rates'] );

The errors fixed themselves at one point but now are back so not sure what temporarily fixed the issue.

Anyone any idea what would cause the $package['rates'] to fail? I still have all shipping rates listed within WooCommerce admin.

Thanks.

来源:https://stackoverflow.com/questions/59898014/woocommerce-account-side-package-rates-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!