Woo Hooks

(BU)Woo Hooks runs a WordPress action at a position you choose in a Bricks layout. Use it when a custom product, cart, or account template leaves out a WooCommerce action that an extension relies on. You can also create a custom action point and attach your own PHP callback to it.

How it works: The element calls the action when it renders. It does not move existing callbacks from another position or disable the original action in WooCommerce. If both the native template and your element run the same action, its callbacks can run twice.

Use a WooCommerce Hook


  1. In Bricks → BricksUltimate → Woo Elements, enable Woo Hooks and save. Reopen the Bricks editor.
  2. Find the exact action name your extension or snippet uses. Check which WooCommerce template normally fires it and whether that action is already present in your Bricks layout.
  3. Add (BU)Woo Hooks where the action should run, then select the name under Hook. Use one element per action point. Place it inside the product loop only when its callback should run once per product; place archive-wide output outside the repeated card.
  4. Enable Render with wrapper if you want a surrounding div that carries the element's Bricks classes and attributes. Leave it off when the callback needs to output markup directly into a particular context. For example, a callback that prints a table row must run in a table section that accepts rows, without a div around it.
  5. Save and test on the storefront in the same context the callback expects. A hook can produce no visible output if nothing is attached, a callback is conditional, or it only performs background work.

Common Placement Examples

  • Product card: If an extension uses woocommerce_after_shop_loop_item_title, place the hook inside the repeated card near the title. Check for duplicate price and rating output, since other callbacks can share the same action.
  • Single product: Place an action such as woocommerce_after_single_product_summary below your summary only if that location is missing. Depending on the callbacks registered, it can render tabs, upsells, or related products as well as extension content. If you only want one component, a dedicated element is often simpler.
  • Cart: Place a cart action where the expected cart structure exists. Use woocommerce_cart_is_empty in your empty-state layout only. The name does not make the element check whether the cart is empty.
  • My Account: woocommerce_account_navigation can output the standard account navigation if its WooCommerce callback is still registered. If you have disabled the standard menu and want custom links instead, use My Account Navigation. Keep account hooks within the correct signed-in account layout.
  • Checkout: Use (BU)Checkout Hooks, a separate element in the Checkout Builder, for classic checkout positions around customer details, order notes, the review, or totals. Some of its actions pass the WooCommerce checkout object; entering the same action name in Woo Hooks custom mode does not pass that object.

Classic WooCommerce template actions are not interchangeable with Cart or Checkout Block extension points. Firing an action from Bricks does not insert its output inside a WooCommerce block or reproduce block behavior. For block-based layouts, see WooCommerce's hook alternatives reference.

Create a Custom Hook


Use Adds custom hook when you want a named output slot in your layout, or when a plugin documents a compatible action that is not in the picker. The element fires the action; a PHP callback registered elsewhere provides the content. No separate BricksUltimate admin setting is required.

  1. Add (BU)Woo Hooks at the desired location. Under Hook → Custom Hook, choose Adds custom hook.
  2. In Enter custom hook name, enter a unique, prefixed name such as myshop_product_help. Enter only the name, without parentheses or PHP code.
  3. Register a callback on that exact name in a site-specific plugin, a child theme's functions.php, or a trusted snippets tool set to run on the storefront. Do not edit BricksUltimate or WooCommerce plugin files.
  4. Open the page on staging and check that the callback's output appears where you placed the element. If it is a per-product hook, check that it runs in the correct repeated item.

Example: Add a Product Help Note

add_action( 'myshop_product_help', static function () {
    echo '<p class="myshop-product-help">' . esc_html( 'Need help choosing this product? Contact our team.' ) . '</p>';
}, 10, 0 );

The callback prints a paragraph where the element runs myshop_product_help. The 10 sets its priority; lower numbers run earlier if several callbacks share the action. The final 0 declares that it accepts no arguments. See the WordPress add_action() reference for callback registration and priority.

Know the Limits

  • Actions, not filters: The element calls do_action(). Returning a string from a callback does not display it; print escaped output instead. Do not use it to invoke a filter that expects a value to transform.
  • No arguments in custom mode: The element does not pass a product, order, cart item, or checkout object to the callback. Only use callbacks that can run without required parameters. If your callback needs context, resolve and validate it inside the callback.
  • Dynamic names: Bricks resolves dynamic data in the custom hook name before calling the action. The resolved name must match the registered callback exactly. Prefer a fixed name; do not derive the hook name from customer input or an untrusted field.
  • Page-render timing: Use hooks meant for the current rendering context. Do not trigger lifecycle events such as init or callbacks that charge, submit, redirect, or modify data just because a page renders. Avoid a callback that renders a template containing the same hook, which would call it again.

Hook Picker Reference


The following are the built-in choices in (BU)Woo Hooks. Select the name required by your callback, not just the option that sounds closest to where you want the content.

Global

  • WooCommerce layout boundaries: woocommerce_before_main_content, woocommerce_after_main_content, woocommerce_sidebar.
  • Quantity input extensions: woocommerce_before_quantity_input_field, woocommerce_after_quantity_input_field.

Product Loop

  • Archive description and loop boundaries: woocommerce_archive_description, woocommerce_before_shop_loop, woocommerce_after_shop_loop, woocommerce_no_products_found.
  • Individual products: woocommerce_shop_loop, woocommerce_before_shop_loop_item, woocommerce_before_shop_loop_item_title, woocommerce_shop_loop_item_title, woocommerce_after_shop_loop_item_title, woocommerce_after_shop_loop_item.

Single Product

  • Product boundaries: woocommerce_before_single_product, woocommerce_after_single_product.
  • Product summary: woocommerce_before_single_product_summary, woocommerce_single_product_summary, woocommerce_after_single_product_summary.

Cart Page

  • Empty or populated cart: woocommerce_cart_is_empty, woocommerce_before_cart, woocommerce_after_cart.
  • Table and actions: woocommerce_before_cart_table, woocommerce_before_cart_contents, woocommerce_cart_contents, woocommerce_cart_actions, woocommerce_after_cart_contents, woocommerce_after_cart_table.
  • Collateral content: woocommerce_before_cart_collaterals, woocommerce_cart_collaterals.
  • Totals and checkout link: woocommerce_before_cart_totals, woocommerce_cart_totals_before_shipping, woocommerce_cart_totals_after_shipping, woocommerce_cart_totals_before_order_total, woocommerce_cart_totals_after_order_total, woocommerce_proceed_to_checkout, woocommerce_after_cart_totals.

My Account Page

  • Navigation and account content: woocommerce_account_navigation, woocommerce_account_content, woocommerce_account_dashboard, woocommerce_before_my_account, woocommerce_after_my_account.
  • Downloads: woocommerce_before_account_downloads, woocommerce_before_available_downloads, woocommerce_available_downloads, woocommerce_after_available_downloads, woocommerce_after_account_downloads.

Most built-in choices are fired without arguments. With a WooCommerce customer object, woocommerce_before_account_downloads and woocommerce_after_account_downloads receive a boolean indicating whether downloads exist, and woocommerce_available_downloads receives the downloadable-products list. Use those built-in entries rather than custom mode when the callback expects that data.

Test and Troubleshoot


  • Nothing appears: Verify that the element is enabled, the action name matches exactly, and the extension or snippet registers a callback on storefront requests. Test with the expected product, cart, or customer state. For a custom action, try the example callback above first.
  • Content is duplicated: Check the native WooCommerce template, other Bricks hook elements, and the loop wrapper. Leave the action at one intended location. A broad hook can also run several callbacks even when fired only once.
  • PHP reports too few arguments: Check the callback signature. The element cannot supply arbitrary arguments that the original template used to provide. Use the original placement or an appropriate extension-specific integration.
  • The layout breaks: Check the HTML the callback prints. Do not add a div wrapper around table rows or nest a callback's form inside an existing form. Some opening and closing layout actions need matching placement.
  • It disappears after an AJAX update: Verify that the refreshed layout still renders the hook and that the callback's scripts support dynamically replaced content. Test the actual cart, language, or popup flow, not only the builder preview.