woocommerce_after_save_address_validation action-hookWC 3.6.0

Hook: woocommerce_after_save_address_validation.

Allow developers to add custom validation logic and throw an error to prevent save.

Usage

add_action( 'woocommerce_after_save_address_validation', 'wp_kama_woocommerce_after_save_address_validation_action', 10, 4 );

/**
 * Function for `woocommerce_after_save_address_validation` action-hook.
 * 
 * @param int         $user_id      User ID being saved.
 * @param string      $address_type Type of address; 'billing' or 'shipping'.
 * @param array       $address      The address fields.
 * @param WC_Customer $customer     The customer object being saved.
 *
 * @return void
 */
function wp_kama_woocommerce_after_save_address_validation_action( $user_id, $address_type, $address, $customer ){

	// action...
}
$user_id(int)
User ID being saved.
$address_type(string)
Type of address; 'billing' or 'shipping'.
$address(array)
The address fields.
$customer(WC_Customer)
The customer object being saved.

Changelog

Since 3.6.0 Introduced.

Where the hook is called

WC_Form_Handler::save_address()
woocommerce_after_save_address_validation
woocommerce/includes/class-wc-form-handler.php 200
do_action( 'woocommerce_after_save_address_validation', $user_id, $address_type, $address, $customer );

Where the hook is used in WooCommerce

woocommerce/src/Blocks/Domain/Services/CheckoutFieldsFrontend.php 47
add_action( 'woocommerce_after_save_address_validation', array( $this, 'save_address_fields' ), 10, 4 );