if( !class_exists('WooCommerceNotifyChanges') ){ class WooCommerceNotifyChanges{ function __construct(){ // customer saves main account data add_action('woocommerce_save_account_details', array( $this, 'woocommerce_send_notification' )); // customer saves billing or shipping data add_action('woocommerce_customer_save_address', array( $this, 'woocommerce_send_notification' )); } function woocommerce_send_notification(){ $body = ''; $to = 'email@kamtoposlat'; //address that will receive this email $subject = 'Uživatel upravil své údaje'; $curr_user = wp_get_current_user(); $user_id = $curr_user->ID; $curr_username = $curr_user->data->user_login; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= ''; $body .= '
Účet
Uživatel: ' . $curr_username . '
 
Fakturační údaje
Křestní jméno: ' . get_user_meta( $user_id, 'billing_first_name', true ). '
Příjmení: ' . get_user_meta( $user_id, 'billing_last_name', true ) . '
Společnost: ' . get_user_meta( $user_id, 'billing_company', true ) . '
Ulice a č.p.: ' . get_user_meta( $user_id, 'billing_address_1', true ) . '
Město: ' . get_user_meta( $user_id, 'billing_city', true ) . '
PSČ: ' . get_user_meta( $user_id, 'billing_postcode', true ) . '
Země: ' . get_user_meta( $user_id, 'billing_country', true ) . '
Telefon: ' . get_user_meta( $user_id, 'billing_phone', true ) . '
Email: ' . get_user_meta( $user_id, 'billing_email', true ) . '
 
Doručovací údaje
Křestní jméno: ' . get_user_meta( $user_id, 'shipping_first_name', true ). '
Příjmení: ' . get_user_meta( $user_id, 'shipping_last_name', true ) . '
Společnost: ' . get_user_meta( $user_id, 'shipping_company', true ) . '
Ulice a č.p.: ' . get_user_meta( $user_id, 'shipping_address_1', true ) . '
Město: ' . get_user_meta( $user_id, 'shipping_city', true ) . '
PSČ: ' . get_user_meta( $user_id, 'shipping_postcode', true ) . '
Země: ' . get_user_meta( $user_id, 'shipping_country', true ) . '
'; //set content type as HTML $headers = array('Content-Type: text/html; charset=UTF-8;'); //send email if( wp_mail( $to, $subject, $body, $headers ) ){ //echo 'email sent'; }else{ //echo 'email NOT sent'; } //exit(); } } new WooCommerceNotifyChanges(); }