Hooks reference
Every action and filter the plugins provide, with their arguments.
Lifecycle
| Hook | Arguments | Use |
|---|---|---|
siteryn_vs_loaded (action) | $plugin | Free booted with its requirements met; extensions (and Pro) start here |
siteryn_vs_upgrade (action) | $old_version, $new_version | On init (20) when the stored version differs; $old_version is false on a fresh install. Free re-saves its settings with new defaults here |
siteryn_vs_deactivated (action) | - | When Free is deactivated; data is kept |
siteryn_vs_pro_loaded (action) | $plugin | Pro booted; Free then hides Get Premium and shows Pro on System Status |
siteryn_vs_pro_upgrade (action) | $old_version, $new_version | Pro's version changed |
Swatch types and data
| Hook | Arguments | Use |
|---|---|---|
siteryn_vs_swatch_types | $types | Types offered on Products → Attributes (key => label). Free: select, color, image, label; Pro adds dual_color, radio, image_label |
siteryn_vs_attribute_swatch_type | $type, $attribute, $product | An attribute's configured type, before the enable switches and conversion (Pro: per-product type at 10, Pro type fallbacks at 20) |
siteryn_vs_attribute_display_type | $type, $attribute, $product, $settings | The final type; return select to keep the dropdown |
siteryn_vs_swatch_type_family | $family, $type | The styling family a type is drawn with (color, image, label or your own) |
siteryn_vs_swatch_items | $items, $type, $args | One attribute's items: value, name, label, color, image_id, image_url, term, selected |
siteryn_vs_multilingual_term_meta_keys | $keys | Term meta kept in step across translations under Polylang: meta key => copy or translate |
siteryn_vs_term_fields (action) | $taxonomy, $type, $term | Inside a term's swatch fields (add form: $term is null); render fields for your type |
siteryn_vs_save_term_fields (action) | $term_id, $taxonomy, $type | After a term's swatch fields are saved (nonce and capability checked) |
Markup
| Hook | Arguments | Use |
|---|---|---|
siteryn_vs_should_render_swatches | $render, $args | Whether swatches replace this dropdown ($args are the wc_dropdown_variation_attribute_options() args) |
siteryn_vs_swatches_html | $html, $items, $type, $context | One attribute's complete swatch group |
siteryn_vs_group_classes | $classes, $type, $context | A group's classes; $context has attribute, product and, on lists, archive |
siteryn_vs_swatch_item_html | $inner, $item, $type | One swatch button's inner markup (Pro types at 10, tooltips at 20) |
siteryn_vs_swatch_classes | $classes, $item, $type | One swatch button's classes |
siteryn_vs_swatches_allowed_html | $allowed | The wp_kses() list used for swatch markup |
add_filter( 'siteryn_vs_should_render_swatches', function ( $render, $args ) {
return ( isset( $args['product'] ) && 123 === $args['product']->get_id() ) ? false : $render;
}, 10, 2 );
Assets and CSS
| Hook | Arguments | Use |
|---|---|---|
siteryn_vs_should_enqueue_assets | $should | Load storefront assets up front (default: variable product pages; Pro adds shop and product taxonomy pages). Assets also load on demand wherever swatches render |
siteryn_vs_assets_enqueued (action) | - | Right after Free's storefront assets are enqueued; enqueue add-on assets here |
siteryn_vs_settings_css | $css, $settings, $scope | The settings CSS; $scope is :root or .siteryn-vs-preview |
Settings page
| Hook | Arguments | Use |
|---|---|---|
siteryn_vs_settings_sections | $sections | The tab tree: label, option_group, option_name, render_callback, has_save_button |
siteryn_vs_settings_fields | $fields | The field schema: section, type, label, default, group, group_icon, group_description, choices, min, max, help |
siteryn_vs_settings_get_all | $settings | The resolved Free settings every time they are read |
siteryn_vs_settings_save_redirect | $redirect, $option_name | Return array( 'tab' => ..., 'message' => ... ) to refuse an AJAX save and open another tab |
siteryn_vs_settings_reset_actions | $actions | Option name => admin-post reset action, so your tabs get a Reset card |
siteryn_vs_settings_preview_sections | $sections | Tabs that show a Live Preview card |
siteryn_vs_settings_preview_rows | $rows, $section, $samples | A tab's preview rows (type, label, items, context); an item may set disabled |
siteryn_vs_preview_request (action) | $request | During a Live Preview request, with every form's unsaved values |
siteryn_vs_settings_sidebar (action) | $section | Inside a tab's right sidebar, before the Reset card |
siteryn_vs_settings_main_after (action) | $section | Inside a tab's main column, after its form |
siteryn_vs_settings_nav_groups | $groups | Menu groups in order: settings, pro, system |
siteryn_vs_settings_nav_group | $group, $section | Which group a tab is listed under |
siteryn_vs_settings_nav_parent | $parent, $section | The menu item a tab is a section tab of |
siteryn_vs_settings_nav_parent_label | $label, $section | A menu item's name while it heads section tabs (Color heads "Swatches") |
siteryn_vs_settings_sectab_label | $label, $section | A tab's name in the section tabs |
siteryn_vs_settings_nav_visible | $visible, $section | Hide a tab from the menu |
siteryn_vs_settings_nav_badge | $badge, $section | Badge text (Pro uses PRO) |
siteryn_vs_settings_nav_icon | $dashicon, $section | Dashicon class |
siteryn_vs_settings_nav_sublabel | $sublabel, $section | Menu sub-label |
siteryn_vs_settings_description | $description, $section | Text under the page title |
siteryn_dashboard_plugins | $plugins | Shared by Siteryn plugins: cards on the Siteryn Welcome page (slug, title, icon) |
Pro
| Hook | Arguments | Use |
|---|---|---|
siteryn_vs_pro_license_active | $active | Pro's license state as License::is_active() reports it (for tests and staging; doesn't change what the license server allows) |
siteryn_vs_pro_settings_get_all | $settings | The resolved Pro settings |
siteryn_vs_pro_archive_card_hooks | $hooks | Extra actions (hook => priority) where archive swatches are printed inside a product card; default siteryn_product_card_after_body => 10. The action may pass the WC_Product |
add_filter( 'siteryn_vs_pro_archive_card_hooks', function ( $hooks ) {
$hooks['my_theme_product_card_footer'] = 10;
return $hooks;
} );
Shared Siteryn hooks
| Hook | Arguments | Use |
|---|---|---|
siteryn_deactivation_feedback_endpoint | $url | Where the optional deactivation survey is posted (default https://siteryn.com/wp-json/siteryn/v1/feedback/deactivation, or the SITERYN_FEEDBACK_ENDPOINT constant) |
The plugin also applies WooCommerce's woocommerce_variation_option_name to swatch names, exactly as the dropdown does.