WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Utilities

CartController::select_shipping_rate() public WC 1.0

Selects a shipping rate.

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

No Hooks.

Return

null. Nothing.

Usage

$CartController = new CartController();
$CartController->select_shipping_rate( $package_id, $rate_id );
$package_id(int|string) (required)
ID of the package to choose a rate for.
$rate_id(string) (required)
ID of the rate being chosen.

Code of CartController::select_shipping_rate() WC 5.7.1

public function select_shipping_rate( $package_id, $rate_id ) {
	$cart                        = $this->get_cart_instance();
	$session_data                = wc()->session->get( 'chosen_shipping_methods' ) ? wc()->session->get( 'chosen_shipping_methods' ) : [];
	$session_data[ $package_id ] = $rate_id;

	wc()->session->set( 'chosen_shipping_methods', $session_data );
}