woocommerce_store_api_cart_select_shipping_rate
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.
Использование
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(строка|null)
- The sanitized ID of the package being updated. Null if all packages are being updated.
- $rate_id(строка)
- The sanitized chosen rate ID for the package.
- $request(\WP_REST_Request)
- Full details about the request.
Список изменений
С версии 9.0.0 | Введена. |
Где вызывается хук
woocommerce_store_api_cart_select_shipping_rate
woocommerce/src/StoreApi/Routes/V1/CartSelectShippingRate.php 108
do_action( 'woocommerce_store_api_cart_select_shipping_rate', $package_id, $rate_id, $request );