How to add HTML Block to Shop page?
-
Hi Elise,
Can you please help, how can I add HTML block to the WooCommerce shop page?
I need to add some text copy with keywords for SEO on my shop: https://www.independent.wine/wine-shop/
In Categories, you have a special field for HTML blocks, and I have been doing it quite successfully (example here: https://www.independent.wine/product-category/red-wine/) But I cannot figure out how to correctly add it to the Shop page. Please help!
Hi Elise,
Can you please check, will this work (allow me to add HTML block) to the Shop page?
add_action( ‘woocommerce_before_shop_loop’, ‘echo do_shortcode(‘[html_block id="1848"]‘)’, 10 );
I found this article, and copied the logic.
https://businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/
Hello,
You can try to add your content directly to the shop page content in Dashboard -> Pages -> edit your shop page. If it will not work, you can try to apply the code from the article.
Kind Regards
Artem,
Thanks, you are right, I simply edited the page withe WP Bakery and it added the text above the Prodiuct grid.
I think if I wanted to add text below the Product grid on the shop page, I would need to use something like this – is my synthax correct?
add_action( ‘woocommerce_after_shop_loop’, ‘echo do_shortcode(‘[html_block id="1848"]‘)’, 10 );
This code probably will work for all catalog pages not on the shop page only. Anyway, you can temporarily put it to check if it works as you expect