I need to add the following shortcode [logoshowcase cat_id="427"]
in all product category pages, so it displays below of the product listed
I’m trying:
add_action( 'woocommerce_after_main_content', 'add_my_text', 20 ); function add_my_text() { echo do_shortcode( '[logoshowcase cat_id="427"]' ); }
But it isn’t working as I would like, specifically in product category archive pages.
Advertisement
Answer
Sorry but this hook works on last woocommerce version, but as storefront sidebar uses this hook too, you will need to lower the hook priority under 10 if you want to display your shortcode below the products loop in archives and single product pages, like:
add_action( 'woocommerce_after_main_content', 'add_my_text', 9 ); function add_my_text() { // Only on Woocommerce Category archive pages if ( is_product_category() ) { echo do_shortcode( '[logoshowcase cat_id="427"]' ); } }
Code goes in functions.php file of your active child theme (or active theme). Tested and works.