How to display content after product summary but before the description?

Rate this post

I want to display some content on my single product page below the product summary and above the tabs with the review

I use this guide as a reference for the hooks, so I thought woocommerce_after_single_product_summary would be the right one. But alas, it displays my content right at the bottom of the product page.

The full code I use is:

function product_summary() {
    echo '<h2>Test!</h2>';

add_action( 'woocommerce_after_single_product_summary', 'product_summary', 11);

All the other hooks I tried work perfectly so I don’t get why this one doesn’t. I do use the plugin ‘custom tabs’ so that might interfere (?)



3rd party plugin might interfere default order of course, but in your case it seems the problem is priority.

By default woocommerce_after_single_product_summary action has 3 hooks:

  • woocommerce_output_product_data_tabs – 10
  • woocommerce_upsell_display – 15
  • woocommerce_output_related_products – 20

So in order to get printed before these 3 ones, you need to use smaller priority. F.e. 0 or 1 or 2 or 9. But not 11.

If even that one doesn’t work, you will need to debug the code and print all default+custom hooks of woocommerce_after_single_product_summary.

To see which hooks the given action has, you can use this code (at footer area of your template f.e.):

 global $wp_filter;

Leave a Reply

Your email address will not be published.

Back to top button