Closed waclawjacek closed 1 year ago
@waclawjacek I was not able to replicate this issue. Do you have the steps to replicate the problem?
Hi @johndcoy! I gave the code a closer look and it looks like this is the relevant bit of code in woocommerce-services.php
:
On line 1111, the calculate_shipping_for_package
call is actually a call on something from WC Core, and it is doing this:
/**
* Calculate shipping rates for a package,
*
* Calculates each shipping methods cost. Rates are stored in the session based on the package hash to avoid re-calculation every page load.
*
* @param array $package Package of cart items.
* @param int $package_key Index of the package being calculated. Used to cache multiple package rates.
*
* @return array|bool
*/
public function calculate_shipping_for_package( $package = array(), $package_key = 0 ) {
// If shipping is disabled or the package is invalid, return false.
if ( ! $this->enabled || empty( $package ) ) {
return false;
}
$package['rates'] = array();
Meaning, this method can sometimes return false
instead of an array with the "rates" index which WCS&T should support (especially since the method's docblock says it does it) but it doesn't. We should add support for it.
A little update : I have fixed the issue in this PR. But still cannot merge it because some tests are failing. I'm still trying to check what's going on at the moment.
@iyut, @samnajian has encountered this recently as well. You could try getting in touch with him to discuss this!
@waclawjacek thanks for the info! I'll try to get in touch with him.
7091741-zen
Reported in p1683027614033619-slack-C7U3Y3VMY