WC_Shipping_Method::get_rates_for_package()publicWC 2.6.0

Return calculated rates for a package.

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.

WC_Shipping_Method::get_rates_for_package() code WC 8.6.1

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;
}