Skip to main content

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
HookParametersDescription
flavor_header_beforeBefore the <header> element
flavor_header_startStart of <header>, before header content
flavor_header_endEnd of <header>, after header content
flavor_header_afterAfter <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
HookParametersDescription
flavor_content_beforeAfter header, before main content area
flavor_content_afterAfter main content, before footer
flavor_footer_beforeBefore the <footer> element
flavor_footer_startStart of <footer>
flavor_footer_widgetsInside footer widget area
flavor_footer_socialIn footer social links area
flavor_footer_endEnd of <footer>
flavor_footer_afterAfter <footer> closes
flavor_render_footerTriggers 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

HookParametersDescription
flavor_shop_beforeBefore shop/product listing content
flavor_shop_afterAfter shop/product listing content
add_action('flavor_shop_before', function() {
echo '<div class="shop-promotion-banner">Summer Sale — 20% off!</div>';
});

Single Product

HookParametersDescription
flavor_single_product_beforeBefore single product content
flavor_single_product_summaryInside product summary (after title/price, before tabs)
flavor_single_product_tabsIn product tabs area
flavor_product_actions$productIn product actions area (add to cart, wishlist, etc.)
flavor_single_product_relatedIn related products area
flavor_single_product_afterAfter 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

HookParametersDescription
flavor_categories_beforeBefore categories listing
flavor_categories_afterAfter categories listing

Cart

HookParametersDescription
flavor_cart_beforeBefore cart content
flavor_cart_afterAfter cart content
add_action('flavor_cart_before', function() {
echo '<div class="free-shipping-progress">Add 15EUR more for free shipping!</div>';
});

Checkout

HookParametersDescription
flavor_checkout_beforeBefore checkout form
flavor_checkout_afterAfter checkout form
add_action('flavor_checkout_before', function() {
echo '<div class="checkout-trust"><span>Secure 256-bit SSL Checkout</span></div>';
});

Order Received

HookParametersDescription
flavor_order_received_beforeBefore order received / thank you page
flavor_order_received_afterAfter order received / thank you page

My Account

HookParametersDescription
flavor_account_beforeBefore my-account page content
flavor_account_afterAfter my-account page content

Theme Lifecycle Hooks

Actions

HookParametersDescription
flavor_initialized$bootstrapAfter theme DDD bootstrap completes
flavor_register_services$containerDuring theme service registration
flavor_components_loaded$bootstrapAfter all theme components are loaded
flavor_register_translationsWhen translation system initializes
add_action('flavor_initialized', function($bootstrap) {
// Theme is ready — safe to interact with theme services
});

add_action('flavor_register_translations', function() {
flavor_register_string('my_plugin.welcome', 'Welcome to our store');
});

Module Hooks

Stock Alerts

HookParametersDescription
flavor_stock_alert_subscribed$productId, $email, $variantIdCustomer subscribes to stock alert
flavor_stock_alert_sent$alertId, $alertStock alert email sent

Request Quote

HookParametersDescription
flavor_quote_created$quoteIdNew quote request submitted
flavor_quote_responded$quoteIdMerchant responds to quote
flavor_quote_accepted$quoteIdCustomer accepts quote
flavor_quote_converted$quoteId, $orderIdAccepted quote converted to order

PDF Invoices

HookParametersDescription
flavor_invoice_generated$invoiceId, $orderIdPDF invoice generated

Points & Rewards

HookParametersDescription
flavor_points_transaction_added$customerId, $points, $type, $sourceLoyalty 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

HookParametersDescription
flavor_newsletter_subscribed$email, $nameUser subscribes via newsletter block
add_action('flavor_newsletter_subscribed', function($email, $name) {
mailchimp_add_subscriber($email, $name);
}, 10, 2);

Abandoned Cart

HookParametersDescription
flavor_abandoned_cart_email_sent$cartId, $emailNumberRecovery email sent (sequence: 1, 2, 3)

Contact Form

HookParametersDescription
flavor_form_submitted$formId, $data, $formContact form submitted
add_action('flavor_form_submitted', function($formId, $data, $form) {
crm_create_lead($data['email'], $data['name'], $data['message']);
}, 10, 3);

Product Bundles

HookParametersDescription
flavor_add_to_cart$productId, $variantId, $quantityBundle component added to cart

Theme Filters

flavor_initial_state

Modify the initial state object passed to the React frontend.

ParameterTypeDescription
$statearrayThe 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).

ParameterTypeDescription
$totalsarrayThe totals array (subtotal, shipping, tax, total, etc.)
$cartCart|nullThe 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);

Modify popular/suggested search terms shown in the search modal.

ParameterTypeDescription
$termsarrayArray 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.

ParameterTypeDescription
$urlstringThe placeholder image URL
$widthintRequested image width
$heightintRequested image height
$contextstringUsage 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.

ParameterTypeDescription
$postTypesarrayArray 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.

ParameterTypeDefaultDescription
$widthint1200Content width in pixels

flavor_smart_asset_rules

Modify smart asset loading rules (conditional CSS/JS loading).

ParameterTypeDescription
$rulesarrayArray of asset loading rules

flavor_options_readonly

Control whether theme options are read-only (e.g., sandbox/demo mode).

ParameterTypeDefaultDescription
$readonlyboolfalseWhether options are read-only

flavor_header_elements

Modify available header builder elements.

ParameterTypeDescription
$elementsarrayArray of header element definitions

Override whether marketing consent is required for tracking.

ParameterTypeDescription
$requiredboolWhether consent is required

Override whether the current user has given marketing consent.

ParameterTypeDescription
$hasConsentboolWhether user has consented

flavor_cart_subtotal

Provide cart subtotal for modules (e.g., B2B minimum order checks).

ParameterTypeDefaultDescription
$subtotalfloat0The cart subtotal

flavor_get_cart_product_ids

Provide current cart product IDs for modules (e.g., upsell/cross-sell exclusions).

ParameterTypeDefaultDescription
$productIdsarray[]Array of product IDs in cart