Theme Hooks Reference (flavor_*)
All hooks use the flavor_ prefix. Parameters shown with types.
Layout Hooks
These hooks fire in order during header rendering:
flavor_header_before
<header>
flavor_header_start
[...header content...]
flavor_header_end
</header>
flavor_header_after
<main>
flavor_content_before
| Hook | Parameters | Description |
|---|
flavor_header_before | — | Before the <header> element |
flavor_header_start | — | Start of <header>, before header content |
flavor_header_end | — | End of <header>, after header content |
flavor_header_after | — | After <header> closes |
add_action('flavor_header_before', function() {
echo '<div class="announcement-bar">Free shipping over 50EUR!</div>';
});
These hooks fire in order during footer rendering:
flavor_content_after
</main>
flavor_footer_before
<footer>
flavor_footer_start
[...footer content...]
flavor_footer_widgets
flavor_footer_social
flavor_footer_end
</footer>
flavor_footer_after
| Hook | Parameters | Description |
|---|
flavor_content_before | — | After header, before main content area |
flavor_content_after | — | After main content, before footer |
flavor_footer_before | — | Before the <footer> element |
flavor_footer_start | — | Start of <footer> |
flavor_footer_widgets | — | Inside footer widget area |
flavor_footer_social | — | In footer social links area |
flavor_footer_end | — | End of <footer> |
flavor_footer_after | — | After <footer> closes |
flavor_render_footer | — | Triggers footer template rendering (internal) |
add_action('flavor_footer_before', function() {
echo '<div class="pre-footer-cta">Subscribe to our newsletter!</div>';
});
add_action('flavor_footer_widgets', function() {
echo '<div class="footer-trust-badges">...</div>';
});
eCommerce Page Hooks
Shop / Product Listing
| Hook | Parameters | Description |
|---|
flavor_shop_before | — | Before shop/product listing content |
flavor_shop_after | — | After shop/product listing content |
add_action('flavor_shop_before', function() {
echo '<div class="shop-promotion-banner">Summer Sale — 20% off!</div>';
});
Single Product
| Hook | Parameters | Description |
|---|
flavor_single_product_before | — | Before single product content |
flavor_single_product_summary | — | Inside product summary (after title/price, before tabs) |
flavor_single_product_tabs | — | In product tabs area |
flavor_product_actions | $product | In product actions area (add to cart, wishlist, etc.) |
flavor_single_product_related | — | In related products area |
flavor_single_product_after | — | After all single product content |
add_action('flavor_single_product_summary', function() {
echo '<div class="trust-badges"><img src="..." alt="Secure checkout" /></div>';
});
add_action('flavor_product_actions', function($product) {
echo '<button class="size-guide-btn" data-product="' . esc_attr($product->id) . '">Size Guide</button>';
});
Categories
| Hook | Parameters | Description |
|---|
flavor_categories_before | — | Before categories listing |
flavor_categories_after | — | After categories listing |
Cart
| Hook | Parameters | Description |
|---|
flavor_cart_before | — | Before cart content |
flavor_cart_after | — | After cart content |
add_action('flavor_cart_before', function() {
echo '<div class="free-shipping-progress">Add 15EUR more for free shipping!</div>';
});
Checkout
| Hook | Parameters | Description |
|---|
flavor_checkout_before | — | Before checkout form |
flavor_checkout_after | — | After checkout form |
add_action('flavor_checkout_before', function() {
echo '<div class="checkout-trust"><span>Secure 256-bit SSL Checkout</span></div>';
});
Order Received
| Hook | Parameters | Description |
|---|
flavor_order_received_before | — | Before order received / thank you page |
flavor_order_received_after | — | After order received / thank you page |
My Account
| Hook | Parameters | Description |
|---|
flavor_account_before | — | Before my-account page content |
flavor_account_after | — | After my-account page content |
Theme Lifecycle Hooks
Actions
| Hook | Parameters | Description |
|---|
flavor_initialized | $bootstrap | After theme DDD bootstrap completes |
flavor_register_services | $container | During theme service registration |
flavor_components_loaded | $bootstrap | After all theme components are loaded |
flavor_register_translations | — | When translation system initializes |
add_action('flavor_initialized', function($bootstrap) {
});
add_action('flavor_register_translations', function() {
flavor_register_string('my_plugin.welcome', 'Welcome to our store');
});
Module Hooks
Stock Alerts
| Hook | Parameters | Description |
|---|
flavor_stock_alert_subscribed | $productId, $email, $variantId | Customer subscribes to stock alert |
flavor_stock_alert_sent | $alertId, $alert | Stock alert email sent |
Request Quote
| Hook | Parameters | Description |
|---|
flavor_quote_created | $quoteId | New quote request submitted |
flavor_quote_responded | $quoteId | Merchant responds to quote |
flavor_quote_accepted | $quoteId | Customer accepts quote |
flavor_quote_converted | $quoteId, $orderId | Accepted quote converted to order |
PDF Invoices
| Hook | Parameters | Description |
|---|
flavor_invoice_generated | $invoiceId, $orderId | PDF invoice generated |
Points & Rewards
| Hook | Parameters | Description |
|---|
flavor_points_transaction_added | $customerId, $points, $type, $source | Loyalty points added/deducted |
add_action('flavor_points_transaction_added', function($customerId, $points, $type, $source) {
if ($points > 100) {
send_milestone_notification($customerId, $points);
}
}, 10, 4);
Newsletter
| Hook | Parameters | Description |
|---|
flavor_newsletter_subscribed | $email, $name | User subscribes via newsletter block |
add_action('flavor_newsletter_subscribed', function($email, $name) {
mailchimp_add_subscriber($email, $name);
}, 10, 2);
Abandoned Cart
| Hook | Parameters | Description |
|---|
flavor_abandoned_cart_email_sent | $cartId, $emailNumber | Recovery email sent (sequence: 1, 2, 3) |
| Hook | Parameters | Description |
|---|
flavor_form_submitted | $formId, $data, $form | Contact form submitted |
add_action('flavor_form_submitted', function($formId, $data, $form) {
crm_create_lead($data['email'], $data['name'], $data['message']);
}, 10, 3);
Product Bundles
| Hook | Parameters | Description |
|---|
flavor_add_to_cart | $productId, $variantId, $quantity | Bundle component added to cart |
Theme Filters
flavor_initial_state
Modify the initial state object passed to the React frontend.
| Parameter | Type | Description |
|---|
$state | array | The state array (settings, translations, cart data, etc.) |
add_filter('flavor_initial_state', function($state) {
$state['myPlugin'] = [
'apiUrl' => rest_url('my-plugin/v1/'),
'settings' => get_my_plugin_settings(),
];
return $state;
});
flavor_cart_totals
Modify cart totals before display (sidebar cart and cart page).
| Parameter | Type | Description |
|---|
$totals | array | The totals array (subtotal, shipping, tax, total, etc.) |
$cart | Cart|null | The cart entity |
add_filter('flavor_cart_totals', function($totals, $cart) {
if ($totals['subtotal'] < 30) {
$totals['handling_fee'] = 2.50;
$totals['total'] += 2.50;
}
return $totals;
}, 10, 2);
flavor_popular_search_terms
Modify popular/suggested search terms shown in the search modal.
| Parameter | Type | Description |
|---|
$terms | array | Array of search term strings |
add_filter('flavor_popular_search_terms', function($terms) {
return ['New Arrivals', 'Sale', 'Best Sellers', 'Gift Cards'];
});
flavor_no_image_url
Modify the placeholder image URL when a product has no image.
| Parameter | Type | Description |
|---|
$url | string | The placeholder image URL |
$width | int | Requested image width |
$height | int | Requested image height |
$context | string | Usage context ('product', 'category') |
add_filter('flavor_no_image_url', function($url, $width, $height, $context) {
if ($context === 'product') {
return get_template_directory_uri() . '/assets/img/no-product.svg';
}
return $url;
}, 10, 4);
flavor_builder_post_types
Modify which post types support the Visual Page Builder.
| Parameter | Type | Description |
|---|
$postTypes | array | Array of supported post type slugs |
add_filter('flavor_builder_post_types', function($postTypes) {
$postTypes[] = 'portfolio';
return $postTypes;
});
flavor_content_width
Modify the global content width.
| Parameter | Type | Default | Description |
|---|
$width | int | 1200 | Content width in pixels |
flavor_smart_asset_rules
Modify smart asset loading rules (conditional CSS/JS loading).
| Parameter | Type | Description |
|---|
$rules | array | Array of asset loading rules |
flavor_options_readonly
Control whether theme options are read-only (e.g., sandbox/demo mode).
| Parameter | Type | Default | Description |
|---|
$readonly | bool | false | Whether options are read-only |
Modify available header builder elements.
| Parameter | Type | Description |
|---|
$elements | array | Array of header element definitions |
flavor_marketing_consent_required
Override whether marketing consent is required for tracking.
| Parameter | Type | Description |
|---|
$required | bool | Whether consent is required |
flavor_marketing_has_consent
Override whether the current user has given marketing consent.
| Parameter | Type | Description |
|---|
$hasConsent | bool | Whether user has consented |
flavor_cart_subtotal
Provide cart subtotal for modules (e.g., B2B minimum order checks).
| Parameter | Type | Default | Description |
|---|
$subtotal | float | 0 | The cart subtotal |
flavor_get_cart_product_ids
Provide current cart product IDs for modules (e.g., upsell/cross-sell exclusions).
| Parameter | Type | Default | Description |
|---|
$productIds | array | [] | Array of product IDs in cart |