woocommerce_store_api_cart_errors
Fires an action to validate the cart.
Functions hooking into this should add custom errors using the provided WP_Error instance.
Usage
add_action( 'woocommerce_store_api_cart_errors', 'wp_kama_woocommerce_store_api_cart_errors_action', 10, 2 );
/**
* Function for `woocommerce_store_api_cart_errors` action-hook.
*
* @param \WP_Error $errors WP_Error object.
* @param \WC_Cart $cart Cart object.
*
* @return void
*/
function wp_kama_woocommerce_store_api_cart_errors_action( $errors, $cart ){
// action...
}
Changelog
| Since 7.2.0 | Introduced. |
Where the hook is called
woocommerce_store_api_cart_errors
woocommerce/src/StoreApi/Utilities/CartController.php 496
do_action( 'woocommerce_store_api_cart_errors', $cart_errors, $cart );