The woocommerce_after_single_product_summary Hook Explained

The woocommerce_after_single_product_summary Hook Explained

Everything below the product summary on a single product page, the tabs, the upsells, the related products, is all controlled by one action hook. If you need to add a banner there, remove the related products block, or change the order things appear in, woocommerce_after_single_product_summary is where that happens.

The Code

Here’s a snippet that adds a custom trust badge banner right after the summary, removes the upsell products block, and moves related products to run before the product tabs instead of after:

add_action( 'woocommerce_after_single_product_summary', 'fixelar_trust_badge_banner', 4 );

function fixelar_trust_badge_banner() {
    echo '<div class="fixelar-trust-badges">';
    echo '<p>' . esc_html__( 'Free shipping on orders over $75. 30-day returns.', 'woocommerce' ) . '</p>';
    echo '</div>';
}

// Remove upsell products
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 );

// Move related products to run before the tabs (priority 5 instead of 20)
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 5 );

Where to Put This Code

This goes in your child theme’s functions.php, or in a snippets plugin like Code Snippets. Never edit a parent theme’s template files or functions.php directly, since updates will overwrite your changes without warning.

One detail that catches people off guard: remove_action() only works if you pass the exact same priority the function was originally hooked with. WooCommerce hooks woocommerce_upsell_display at priority 15 and woocommerce_output_related_products at priority 20 by default. If your remove_action() call uses a different priority number than the original, WordPress won’t find a match, and the function keeps running like nothing happened.

How the Hook Works, Line by Line

woocommerce_after_single_product_summary is an action hook, which means it runs code rather than filtering a value. It fires once, right after the summary column (title, price, add to cart, meta) closes on a single product page.

By default, WooCommerce hooks three things into it: woocommerce_output_product_data_tabs at priority 10, woocommerce_upsell_display at priority 15, and woocommerce_output_related_products at priority 20. Since lower priority numbers run first, that’s why tabs show up before upsells, and upsells before related products, on a stock WooCommerce theme.

add_action( 'woocommerce_after_single_product_summary', 'fixelar_trust_badge_banner', 4 ); adds a new function to that same hook. The 4 sets its priority lower than the default tabs (10), so it renders first, right above the tabs.

remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); unhooks a default WooCommerce function. You need the function name and its original priority, both exactly as WooCommerce registered them, or the removal silently fails.

Moving related products earlier is just a remove-then-re-add: unhook it from priority 20, then hook it back in at a lower number so it runs sooner in the sequence.

Real Use Cases

Adding trust signals or shipping info below the fold. A short banner about return policy or shipping thresholds placed right after the summary, before tabs and related products, is a common conversion tweak that doesn’t require touching a template file.

Removing upsells or related products on specific product types. Some stores don’t want cross-sell noise on high-consideration or custom-quote products. Wrapping the remove_action() call in a conditional based on product category keeps the change scoped instead of site-wide.

Reordering content to prioritize social proof. Stores that rely heavily on reviews sometimes move the tabs (which usually include the Reviews tab) above related products, since a shopper reading reviews is closer to converting than one browsing alternatives.

Injecting third-party widgets without a plugin. Loyalty program widgets, size guides, or comparison tools that need to sit below the summary but above (or below) the default WooCommerce blocks are a straightforward fit for this hook, avoiding a full template override.

Common Issues

My remove_action() isn’t removing anything. Double check the priority number matches exactly what WooCommerce used to add it. A mismatch is the most common reason removal silently fails.

My new function isn’t appearing where I expect. Priority controls order, and ties are broken by registration order. If your banner and an existing WooCommerce function share the same priority number, whichever one was hooked first in the code execution order renders first, so an explicit, unique priority avoids ambiguity.

Content shows up twice. This usually means the child theme also has a duplicate add_action() call, often left over from an earlier customization or a theme’s demo content import. Search your child theme for the function name before adding a new hook.

Changes work on some product templates but not others. If your theme overrides content-single-product.php in its own template folder, the theme’s version of the file, not WooCommerce’s default template, is what determines whether this hook even fires in the expected location. Check for a theme override before assuming the code is wrong.

If you’d rather have the layout of your product pages customized and tested properly, this is exactly the kind of work Fixelar handles as part of our WooCommerce custom development services. We check hook changes against your actual theme and plugin stack, so nothing breaks after the next update.