woocommerce_before_single_product_summary
This action runs above the product summary in WooCommerce's classic single-product template, where the sale badge and image gallery normally appear.
Quick Reference
| Type | Action hook |
|---|---|
| Area | Single product |
| Arguments | None |
| Source | WooCommerce code reference |
How It Works
WooCommerce calls do_action() before opening the summary column. Its default callbacks output the sale badge at priority 10 and the product images at priority 20. You can register another callback with add_action() and choose its position using the priority number.
PHP Example
add_action( 'woocommerce_before_single_product_summary', function () {
echo '<p class="product-notice">Please review the product details.</p>';
}, 30 );
This adds a short note after the default product images. The example uses fixed text; escape any values drawn from users or other dynamic data before output.
Add the code to a site-specific plugin or a child theme's functions.php file, then test it on a staging site.
HoverCraft in Practice
HoverCraft displays the product gallery beside the details on wider screens and stacks them on smaller screens. This action runs before the details column, so a message added here does not become part of the price or purchase controls. See the WooCommerce Product Pages documentation for the theme's layout.
Common Pitfalls
Priority 30 runs after the default sale badge and product images, but it does not place the callback inside the summary column. To add content among the title, price, and purchase controls, use woocommerce_single_product_summary instead. Check the result on both desktop and mobile because extra markup can affect the gallery layout.
Compatibility
This placement is defined by the classic single-product PHP template. Block-based product templates may not use the same action at the same location.