By default Woocommerce will display your tags, but maybe you want to put them somewhere else or process them a little differently.
Here’s how you get them on your product page.Â
Note, I am going to print them above my add to cart form, but you may want to print them elsewhere.
For a guide on where to print your tags you can refer to this product page hook guide by Business Bloomer.
We are going to place the following snippet in our functions.php
Hello, awesome help! Do you know how to display Tags on product archive/shop pages just below the product title?
I did this with the product short description already, but want to add tags as well.
Example of short description:
add_action( ‘woocommerce_after_shop_loop_item_title’, function() {
global $post;
$short_description = apply_filters( ‘woocommerce_short_description’, $post->post_excerpt );
if ( $short_description ) {
echo ‘<div class=”my-product-entry-description”>’ . wp_kses_post( $short_description ) . ‘</div>’;
}
}, 50 );
Hope you can help me out 🙂
Hey mate, sorry about the late reply. Yes of course I can help you out 🙂 i’ve rewritten your code to include my code, you can copy and paste the following. I’ve also changed a few things so it’s a bit cleaner. Tested and working on my own website. add_action( ‘woocommerce_after_shop_loop_item_title’, ‘wpd_add_tags_description_to_product_loop’, 50 ); function wpd_add_tags_description_to_product_loop() { global $product; if ( is_object( $product ) ) { $short_description = apply_filters( ‘woocommerce_short_description’, $product->get_short_description() ); if ( $short_description ) { echo ‘<div class=”my-product-entry-description”>’ . wp_kses_post( $short_description ) . ‘</div>’; } $product_id = $product->get_id(); // This will hold all of our product tags $tags… Read more »