WC_Cart::get_chosen_shipping_methods( array $calculated_shipping_packages = array() )

Given a set of packages with rates, get the chosen ones only.


Description Description


Parameters Parameters

$calculated_shipping_packages

(Optional) Array of packages.

Default value: array()


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/class-wc-cart.php

	protected function get_chosen_shipping_methods( $calculated_shipping_packages = array() ) {
		$chosen_methods = array();
		// Get chosen methods for each package to get our totals.
		foreach ( $calculated_shipping_packages as $key => $package ) {
			$chosen_method = wc_get_chosen_shipping_method_for_package( $key, $package );
			if ( $chosen_method ) {
				$chosen_methods[ $key ] = $package['rates'][ $chosen_method ];
			}
		}
		return $chosen_methods;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.