public function reload_guest() { // No timeout limit $this->increase_timeout(); // Don't break the JSON result error_reporting(0); header('Content-type: application/json'); $email = $_REQUEST['email']; try { $result = wc_crm_reload_guest($email); die(json_encode($result)); } catch (Exception $e) { $this->die_json_failure_msg($id, '<b><span style="color: #DD3D36;">' . $e->getMessage() . '</span></b>'); } die; }
public function order_status_changed($post_id) { // $post_id and $post are required if (empty($post_id)) { return; } global $wpdb; $user_id = (int) get_post_meta($post_id, '_customer_user', true); $user_email = get_post_meta($post_id, '_billing_email', true); if ($user_id > 0) { wc_crm_reload_customer($user_id); } else { if (!empty($user_email)) { wc_crm_reload_guest($user_email); } } wc_crm_clear_transient(); }