---
title: Notifications Hooks
description: Hooks related to email and push notifications
date: 2024-01-31
---

## Filters

### woonoow_email_default_templates

Modify the list of available email templates.

**Parameters:**
*   `$templates` (array): Associative array of template paths.

### woonoow_email_default_subject

Customize the default subject line for emails.

**Parameters:**
*   `$subject` (string): The default subject.
*   `$recipient` (string): The recipient type (e.g., 'customer', 'admin').
*   `$event` (string): The event triggering the email.

### woonoow_notification_channels

Register or modify available notification channels.

**Parameters:**
*   `$channels` (array): list of channels.

### woonoow_email_variables

Add custom variables to be replaced in email templates.

**Parameters:**
*   `$variables` (array): Key-value pairs of variables.
*   `$event_id` (string): The current event ID.
*   `$data` (array): Function context data.

### woonoow_email_template

Override the resolved template path for an email.

**Parameters:**
*   `$template_path` (string): Absolute path to the template file.

---

## Actions

### woonoow_email_sent

Triggered after an email is successfully sent.

**Parameters:**
*   `$event_id` (string): The event ID.
*   `$recipient_type` (string): Type of recipient.
*   `$email` (string): The email address it was sent to.

### woonoow_send_push_notification

Triggered when the system determines a push notification should be sent.

**Parameters:**
*   `$event_id` (string): The event ID.
*   `$recipient` (object): The recipient user object.
*   `$data` (array): Payload data.
*   `$recipient_type` (string): Type of recipient.
*   `$email` (string): The email address it was sent to.

### woonoow_send_push_notification

Triggered to send a push notification.

**Parameters:**
*   `$event_id` (string): The event key.
*   `$recipient` (WP_User): The recipient user object.
*   `$data` (array): Notification payload data.

### woonoow_notification_events_registry

Filter to register custom notification events.

**Parameters:**
*   `$events` (array): The array of registered events.

**Example:**
```php
add_filter('woonoow_notification_events_registry', function($events) {
    $events['my_custom_event'] = [
        'title' => 'My Custom Event',
        'description' => 'Triggered when something happens',
        'recipient' => 'customer',
    ];
    return $events;
});
```

### woonoow_notification_event_updated

Triggered when a notification event's settings are updated via API.

**Parameters:**
*   `$event_id` (string): The event key.
*   `$channel_id` (string): The channel (email/push).
*   `$enabled` (bool): New status.
*   `$recipient` (string): Recipient type.
