current_package = $package; return $package_name; } /** * More friendly error message when WCS has an error. * * @param string $error_html Generic error message from WC. * @return string */ public function error_no_shipping_available_html( $error_html ) { foreach ( WC()->shipping()->load_shipping_methods( $this->current_package ) as $shipping_method ) { if ( $shipping_method instanceof WC_Connect_Shipping_Method ) { // We have to always force validation to run because WC_Shipping could cache package rates. $shipping_method->is_valid_package_destination( $this->current_package ); $errors = $shipping_method->get_package_validation_errors(); if ( $errors->has_errors() ) { return $errors->get_error_message(); } } } return $error_html; } }