Using WooCommerce hooks on custom layouts

Hello,

I’m using custom layouts for both product category and single product pages, but I noticed that the following WooCommerce hooks used by a plugin don’t get triggered:

add_action('woocommerce_before_shop_loop', [$this, 'prepare_notices'], 10);
add_action('woocommerce_before_single_product_summary', [$this, 'prepare_notices'], 10);

The issue is that these actions belong to a third-party plugin which I cannot modify directly.

I read that using a “Hook Element” in the Pro Theme Layout Builder could solve this, but I can’t find any Hook Element available in my editor.

Could you please advise how I can make sure these hooks fire properly on my custom layouts? Is there a setting I’m missing, or another recommended approach?

Thank you for your help!

Hello @sebipopa01,

Thank you for the inquiry.

There is no such thing as a Hook Element in Cornerstone. You might be referring to the WordPress action hooks or filters. You can set the prepare_notices function to hook into any of these actions instead.

do_action('cs_header');
do_action('cs_layout_begin');
do_action('cs_layout_begin_archive');

Please check this documentation: https://developer.wordpress.org/plugins/hooks/actions

Since this is outside the scope of support, we encourage you to check out our One service if you need additional information on how to integrate the plugin function with the builder.

Best regards,

Thanks, cs_layout_begin is helpfull.

Great! Glad to know you managed to resolved the issue. Feel free to open another thread if you have more questions. Have a nice day.

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