So i have edited my function.php file to contain the following code.
However on my shop page it is not showing up at all. I tried increasing the number from 12 to 40, but no difference. I also show my product-archive.php file below. I tried using a do_action(etc etc), but it breaks since the do_action runs in the product-archive.php
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
function add_google_script(){
echo "HELLO HELLO HELLO";
}
add_action('woocommerce_before_shop_loop', 'add_google_script', 12);```
//If my product-archive.php
```if ( woocommerce_product_loop() ) {
/**
* Hook: woocommerce_before_shop_loop.
*
* @hooked woocommerce_output_all_notices - 10
* @hooked woocommerce_result_count - 20
* @hooked woocommerce_catalog_ordering - 30
*/
do_action( 'woocommerce_before_shop_loop' );```
2
Answers
I’m not completely sure what you want to achieve. But this snippet should add the content before the product loop:
Use this action, it will work.