WordPress at Your Fingertips
function is not described

WC_Shipping_Method::get_rates_for_package() public WC 2.6.0

Return calculated rates for a package.

{} It's a method of the class: WC_Shipping_Method{}

No Hooks.

Return

Array.

Usage

$WC_Shipping_Method = new WC_Shipping_Method();
$WC_Shipping_Method->get_rates_for_package( $package );
$package(array) (required)
Package array.

Changelog

Since 2.6.0 Introduced.

Code of WC_Shipping_Method::get_rates_for_package() WC 5.8.0

public function get_rates_for_package( $package ) {
	$this->rates = array();
	if ( $this->is_available( $package ) && ( empty( $package['ship_via'] ) || in_array( $this->id, $package['ship_via'] ) ) ) {
		$this->calculate_shipping( $package );
	}
	return $this->rates;
}