Add Text or Shortcode under image of single product page

I just added the given code into function.php at child theme. I did not change anything in product-image.php It works perfectly now. Is that any issue if it is working like that?

Or do i need to replace the woocommerce_product_thumbnails with the woocommerce_after_single_product_summary in product-image.php to make it work properly?

Thank you.

Hi There,

The suggested code is what you need. No need to edit product-image.php. That is how action hooks work. See this: https://codex.wordpress.org/Glossary#Action

Thank you so much.

You are always welcome!

Cheers.

Hello,

How can i add text or html at the end of the single product page?Just under the description tab.

Thank you,

Hi There,

You can try with this hook: woocommerce_after_single_product

Let us know how it goes!

Do you mean like this?

add_action(‘woocommerce_after_single_product’, ‘html_after_single_product’, 9);
function html_after_single_product() { ?>

Some CONTENT HERE
<?php } Thank you

Hey There,

Yes you are in the right track.
Just make sure that you insert a valid and correct html tags so that it will not broke your site.

Best Regards.

I added, but it appears below “Related Post”. What i want is to make it appears just right below (at the end of) the “Description” tap on the single product page which should be appeared above related post.

Help, please.

Thank you

Hi there,

Would you please kindly get back to us with the exact URL of the page and the login information using the Secure Note functionality of the post to follow up the case and be able to test?

We may be able to achieve what you want with CSS, as the only place that we can actually add text is the place which my colleagues already mentioned.

Thank you

Hey

The code the outputs X Related Products is this.

add_action( 'woocommerce_after_single_product_summary', 'x_woocommerce_output_related_products', 20 );

It’s in the summary. I changed your code from this

add_action('woocommerce_after_single_product', 'html_after_single_product', 5);

to this. Take note of the order also.

add_action('woocommerce_after_single_product_summary', 'html_after_single_product', 10);

And your HTML is now in above Related Products.

Theme customization is outside the scope of our support. For further tweaks, please hire a third party developer.

Thanks.

All done. Appreciated for your great support.
Thank you

You’re welcome.

I just play with this

add_action( ‘woocommerce_after_single_product_summary’, ‘x_woocommerce_output_related_products’, 20 );
function html_x_woocommerce_output_related_products() { ?>
Some CONTENT HERE

<?php} But seem not work. Thank you,

Hello There,

The code is incorrect. Please use this:

add_action( 'woocommerce_after_single_product_summary', 'html_x_woocommerce_output_related_products', 20 );
function html_x_woocommerce_output_related_products() { ?>
	Some CONTENT HERE
<?php }

Please let us know how it goes.

If I want it to be appeared below related products, then shall i add like this?

add_action( ‘woocommerce_after_single_product_summary’, ‘html_below_x_woocommerce_output_related_products’, 20 );
function html_below_x_woocommerce_output_related_products() { ?>
Some CONTENT HERE

<?php } Thank you

Hi There,

Unfortunately, no.
This woocommerce_after_single_product_summary determines the positions and also 20, which means priority of execution: https://developer.wordpress.org/reference/functions/add_action/
See this: https://screencast-o-matic.com/watch/cbXtf02vZj

.custom-cont {
    clear: both;
}

works just great. Appreciated!

You’re always welcome!

For other inquiries, feel free to open a new thread.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.