Reputation: 23
I have woocommerce site and in that when User updates their shipping address then one verifying mail should be send to them. I need hook that checks if any fields are updating or not and when we click "SAVE ADDRESS" and if there is updating any fields.. Mail should be send to them and admin too.
Upvotes: 2
Views: 107
Reputation: 743
Hi and welcome to StackOverflow! your question very broad, consider asking a more specific question next time my friend.
I'm going to help you with this issue. SO you only need a hook that will run when the user edits their address.
/*The WordPress Core woocommerce after save address validation hook.*/
add_action( woocommerce_after_save_address_validation",'woo_address_updated',10, 3);
function woo_address_updated($user_id, $load_address, $address)
{
/* Get the user email*/
$user_info = get_userdata($user_id);
$subj = 'The email subject';
$body = 'This is the body of the email';
/* Send email*/
wp_mail( $user_info->user_email, $subj, $body );
}
Upvotes: 2