Hooks reference
Every action and filter the plugins provide, with their arguments and examples you can copy.
FreePro
Lifecycle
| Action | Arguments | Fires |
siteryn_donations_loaded | $plugin | Once per request, after requirements are met and every service is hooked |
siteryn_donations_upgrade | $from, $to | Once, when the stored version differs from the running one |
siteryn_donations_activated · siteryn_donations_deactivated | | After activation / on deactivation |
Donation products and the Donate page
| Filter | Arguments | Use |
siteryn_donations_is_donation_product | $is_donation, $product | Treat other products as donation products |
siteryn_donations_enabled | $enabled | Master switch (Enable donations) |
siteryn_donations_default_product_id | $product_id | The product the box and shortcode add to |
siteryn_donations_default_product | $product | The automatic product before it is first saved |
siteryn_donations_create_donation_page | $create | Return false to skip creating the Donate page |
siteryn_donations_donation_page_args | $args | wp_insert_post() arguments of the Donate page |
siteryn_donations_price_html | $html, $product | The "From $5" price |
Amounts
$context is where the amount is chosen: product, cart, checkout, cart_block, checkout_block or shortcode (preview in the admin).
| Filter | Arguments | Use |
siteryn_donations_amount_options | $amounts, $context, $product | Fixed amounts (ascending, max 12) |
siteryn_donations_allow_custom_amount | $allowed, $context, $product | Accept a custom amount |
siteryn_donations_amount_limits | $limits, $context, $product | array( 'min' => float, 'max' => float|null ) |
siteryn_donations_default_amount | $amount, $context, $product | Pre-selected amount (must be a fixed amount) |
siteryn_donations_validate_amount | $result, $raw, $context, $product | Final say; return a WP_Error with a shopper-facing message to reject |
add_filter( 'siteryn_donations_amount_options', function ( $amounts, $context ) {
return 'shortcode' === $context ? array( 25, 50, 100, 250 ) : $amounts;
}, 10, 2 );
Cart and orders
| Hook | Arguments | Use |
siteryn_donations_cart_item_data (filter) | $donation, $product_id, $extra | Add your own keys to the stored donation; $extra holds the siteryn_donations_extra[...] inputs |
siteryn_donations_added_to_cart (action) | $key, $amount, $product, $context | After a donation is added |
siteryn_donations_removed_from_cart (action) | $key, $product_id | After a donation line is removed (also when a new amount replaces it) |
siteryn_donations_create_order_line_item (action) | $item, $donation, $order | A donation was recorded on a new order line (classic and block checkout) |
siteryn_donations_order_language (filter) | $language, $order | Language of an order's customer-facing output |
add_action( 'siteryn_donations_added_to_cart', function ( $key, $amount, $product, $context ) {
error_log( sprintf( 'Donation of %s to %s from %s', $amount, $product->get_name(), $context ) );
}, 10, 4 );
Storefront
| Hook | Arguments | Use |
siteryn_donations_widget_should_display (filter) | $display, $context, $product | Show or hide the box (Pro's display rules use it) |
siteryn_donations_widget_args (filter) | $args, $context, $product | Box template arguments (title, texts, classes…) |
siteryn_donations_amount_picker_args (filter) | $args, $context, $product | Amount picker template arguments |
siteryn_donations_amount_picker_allowed_html (filter) | $allowed | Allowed HTML for the picker inside the box; extend it for a template override |
siteryn_donations_after_add_redirect (filter) | $url, $context | Where donors go after adding from the Donate page form; '' to stay |
siteryn_donations_widget_before_form (action) | $args | Inside the box, before the form (Pro's progress bar) |
siteryn_donations_widget_before_actions (action) | $args | Inside the form, before the button (Pro's frequency choice) |
siteryn_donations_widget_after_form (action) | $args | Inside the box, after the form |
siteryn_donations_enqueue_assets (filter) | $enqueue | Load the CSS and JS on more pages |
siteryn_donations_inline_css (filter) | $css | The settings-driven CSS variables |
add_filter( 'siteryn_donations_widget_should_display', function ( $display ) {
return current_user_can( 'wholesale_customer' ) ? false : $display;
} );
Templates
| Hook | Arguments | Use |
siteryn_donations_locate_template (filter) | $path, $template_name | Change the resolved template file |
siteryn_donations_bundled_templates (filter) | $templates | Register your own overridable templates (Pro adds its three) |
siteryn_donations_before_template · siteryn_donations_after_template (actions) | $template_name, $args | Around every template |
Settings and admin
| Hook | Arguments | Use |
siteryn_donations_settings_sections | $sections | Add tabs (label, optional option_group, option_name, render_callback) |
siteryn_donations_settings_fields | $fields | Add fields to a tab |
siteryn_donations_settings_reset_actions | $actions | option_name => admin-post action for Reset to Defaults |
siteryn_donations_settings_save_redirect | $redirect, $option_name | Block a save and send the admin to another tab |
siteryn_donations_settings_nav_groups | $groups | Left-menu groups (overview, settings, system) |
siteryn_donations_settings_nav_group | $group, $section | Which group a tab is listed under |
siteryn_donations_settings_nav_parent | $parent, $section | Put a tab under another menu item |
siteryn_donations_settings_nav_parent_label | $label, $section | Menu name of a top-level tab |
siteryn_donations_settings_nav_family | $family, $parent | Order of a menu item's tabs |
siteryn_donations_settings_nav_icon · _nav_sublabel · _nav_badge · _description | $value, $section | Dashicon, sublabel, badge and description of a tab |
siteryn_donations_settings_panel_sidebar_shortcodes | $shortcodes, $section | Shortcode cards in a tab's sidebar |
siteryn_donations_settings_after_form (action) | $section | After a tab's form |
siteryn_donations_settings_sidebar_{$section} (action) | | In one tab's sidebar, above Reset to Defaults |
siteryn_donations_render_field_{$type} (action) | $field, $value, $name, $id | Render your own field type |
siteryn_donations_sanitize_field_{$type} | $value, $raw, $field | Sanitize your own field type |
siteryn_donations_system_status_cards | $cards | System Status cards (label, value, icon, variant) |
siteryn_dashboard_plugins | $plugins | Shared Siteryn hook: cards on the Welcome page |
All of these are filters unless marked as actions.
Pro Pro
| Hook | Arguments | Use |
siteryn_donations_pro_loaded (action) | $plugin | Pro booted, licensed or not |
siteryn_donations_pro_features_loaded (action) | $plugin | The licensed features were registered |
siteryn_donations_pro_upgrade (action) | $from, $to | The stored Pro version changed |
siteryn_donations_pro_activated · siteryn_donations_pro_deactivated (actions) | | After activation / on deactivation |
siteryn_donations_pro_license_activated · siteryn_donations_pro_license_deactivated (actions) | $success | After an activation / deactivation attempt |
siteryn_donations_pro_counted_statuses | $statuses | Order statuses that count toward campaign totals (default: WooCommerce's paid statuses) |
siteryn_donations_pro_order_tallied (action) | $order, $current, $previous | An order's contribution changed (product_id => amount) |
siteryn_donations_pro_campaign_closed | $closed, $campaign | Whether a campaign still accepts donations |
siteryn_donations_pro_progress_args | $args, $campaign | Progress bar template arguments |
siteryn_donations_pro_product_box_applies | $applies, $product | Whether the box shows on a product page |
siteryn_donations_pro_recurring_intervals | $intervals | Offered frequencies (week, month, year => label) |
siteryn_donations_pro_recurring_donation_paid (action) | $item, $interval, $amount, $order | Once, when an order with a recurring donation is first paid: the integration point for subscriptions |
siteryn_donations_pro_thankyou_message | $message, $order | The thank-you text (plain text) |
siteryn_donations_pro_inline_css | $css | Pro's CSS (progress bar color) |
siteryn_donations_pro_dashboard_after_summary (action) | $range, $summary | On the Dashboard, after the period's figures |
add_filter( 'siteryn_donations_pro_counted_statuses', function ( $statuses ) {
$statuses[] = 'on-hold';
return $statuses;
} );
add_filter( 'siteryn_donations_pro_recurring_intervals', function ( $intervals ) {
unset( $intervals['week'] );
return $intervals;
} );
There is deliberately no filter to force the license active.