woocommerce_store_api_cart_select_shipping_rate action-hookWC 9.0.0

Fires an action after a shipping method has been chosen for package(s) via the Store API.

This allows extensions to perform addition actions after a shipping method has been chosen, but before the cart totals are recalculated.

Usage

add_action( 'woocommerce_store_api_cart_select_shipping_rate', 'wp_kama_woocommerce_store_api_cart_select_shipping_rate_action', 10, 3 );

/**
 * Function for `woocommerce_store_api_cart_select_shipping_rate` action-hook.
 * 
 * @param string|null      $package_id The sanitized ID of the package being updated. Null if all packages are being updated.
 * @param string           $rate_id    The sanitized chosen rate ID for the package.
 * @param \WP_REST_Request $request    Full details about the request.
 *
 * @return void
 */
function wp_kama_woocommerce_store_api_cart_select_shipping_rate_action( $package_id, $rate_id, $request ){

	// action...
}
$package_id(string|null)
The sanitized ID of the package being updated. Null if all packages are being updated.
$rate_id(string)
The sanitized chosen rate ID for the package.
$request(\WP_REST_Request)
Full details about the request.

Changelog

Since 9.0.0 Introduced.

Where the hook is called

CartSelectShippingRate::get_route_post_response()
woocommerce_store_api_cart_select_shipping_rate
woocommerce/src/StoreApi/Routes/V1/CartSelectShippingRate.php 99
do_action( 'woocommerce_store_api_cart_select_shipping_rate', $package_id, $rate_id, $request );

Where the hook is used in WooCommerce

Usage not found.