Action shop page WooCommerce

At the top of the shop page I want to place a global block. See the code below:

add_action( "woocommerce_before_main_content", "add_global_shortcode_shop_head" );
function add_global_shortcode_shop_head() {
	if(x_is_shop()) {
		echo do_shortcode( '[cs_gb id=1712]' );
	}
}

Unfortunately this does not work. Can you help me further?

Hi van den Berg,

woocommerce_before_main_content doesn’t exists. See what is available here.

Also, you can’t use x_before_the_content_begin because woocommerce doesn’t use that action. Woocommerce has its own template and hooks for shop page. What you need maybe this woocommerce_before_shop_loop:

See this documentation.

Hope this helps.

Made it a little easier on myself. Assigned a custom header to the shop page.

Glad to hear you got it sorted., Van.

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