Initial commit of WooNooW Docs
This commit is contained in:
21
contents/docs/hooks/frontend/index.mdx
Normal file
21
contents/docs/hooks/frontend/index.mdx
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Frontend Hooks
|
||||
description: Hooks affecting the storefront and checkout experience
|
||||
date: 2024-01-31
|
||||
---
|
||||
|
||||
## Filters
|
||||
|
||||
### woonoow_ssr_cache_ttl
|
||||
|
||||
Customize the Time-To-Live (TTL) for Server Side Rendered fragments.
|
||||
|
||||
**Parameters:**
|
||||
* `$ttl` (int): Time in seconds (Default: 3600).
|
||||
|
||||
### woonoow_standard_checkout_field_keys
|
||||
|
||||
Modify the standard set of checkout fields recognized by the system.
|
||||
|
||||
**Parameters:**
|
||||
* `$keys` (array): List of field aliases (e.g., ['billing_first_name', ...]).
|
||||
27
contents/docs/hooks/index.mdx
Normal file
27
contents/docs/hooks/index.mdx
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: Hooks Overview
|
||||
description: Overview of Actions and Filters available in WooNooW
|
||||
date: 2024-01-31
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
WooNooW provides a rich set of actions and filters allowing developers to customize almost every aspect of the plugin without modifying core files.
|
||||
|
||||
### Hook Categories
|
||||
|
||||
* [Notifications](/docs/hooks/notifications) - Customize email templates, subjects, and channels.
|
||||
* [Subscriptions](/docs/hooks/subscriptions) - Intercept payment logic and modify gateway behavior.
|
||||
* [Frontend & checkout](/docs/hooks/frontend) - Adjust checkout fields and SSR caching.
|
||||
* [Newsletter](/docs/hooks/newsletter) - Subscribe/unsubscribe events.
|
||||
|
||||
### Usage Example
|
||||
|
||||
```php
|
||||
add_filter('woonoow_email_default_subject', function($subject, $recipient, $event) {
|
||||
if ($event === 'subscription_renewal') {
|
||||
return 'Your subscription is renewing soon!';
|
||||
}
|
||||
return $subject;
|
||||
}, 10, 3);
|
||||
```
|
||||
9
contents/docs/hooks/meta.json
Normal file
9
contents/docs/hooks/meta.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"pages": [
|
||||
"index",
|
||||
"notifications",
|
||||
"subscriptions",
|
||||
"frontend",
|
||||
"newsletter"
|
||||
]
|
||||
}
|
||||
21
contents/docs/hooks/newsletter/index.mdx
Normal file
21
contents/docs/hooks/newsletter/index.mdx
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: Newsletter Hooks
|
||||
description: Hooks related to the Newsletter module
|
||||
---
|
||||
|
||||
## Actions
|
||||
|
||||
### woonoow_newsletter_subscribed
|
||||
|
||||
Triggered when a user subscribes to the newsletter.
|
||||
|
||||
**Parameters:**
|
||||
* `$email` (string): The subscriber's email address.
|
||||
* `$user_id` (int|null): The user ID if logged in, or null.
|
||||
|
||||
### woonoow_newsletter_unsubscribed
|
||||
|
||||
Triggered when a user unsubscribes from the newsletter.
|
||||
|
||||
**Parameters:**
|
||||
* `$email` (string): The subscriber's email address.
|
||||
108
contents/docs/hooks/notifications/index.mdx
Normal file
108
contents/docs/hooks/notifications/index.mdx
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
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.
|
||||
26
contents/docs/hooks/subscriptions/index.mdx
Normal file
26
contents/docs/hooks/subscriptions/index.mdx
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: Subscription Hooks
|
||||
description: Hooks for customizing subscription flows and payments
|
||||
date: 2024-01-31
|
||||
---
|
||||
|
||||
## Filters
|
||||
|
||||
### woonoow_pre_process_subscription_payment
|
||||
|
||||
Intercept the subscription payment process before it begins.
|
||||
|
||||
**Parameters:**
|
||||
* `$result` (null|mixed): Return non-null to short-circuit the process.
|
||||
* `$subscription` (WC_Subscription): The subscription object.
|
||||
* `$order` (WC_Order): The renewal order.
|
||||
|
||||
### woonoow_process_subscription_payment
|
||||
|
||||
Modify or handle the payment processing via a custom gateway logic.
|
||||
|
||||
**Parameters:**
|
||||
* `$result` (null|bool): The result of the payment.
|
||||
* `$gateway` (object): The payment gateway instance.
|
||||
* `$order` (WC_Order): The order being paid.
|
||||
* `$subscription` (WC_Subscription): The subscription object.
|
||||
Reference in New Issue
Block a user