Add function to head “no product found”

It’s better to use PHP to remove things when possible, because if you just use JS, they’re still technically there on the page. What if a visitor is on a slow-loading network and the JS doesn’t kick in for a long time, so they see the filters long enough to use them? If you can find out what actual template file is being used to display the page when there are no products found, you can probably make the changes there and just make them conditional – only show the filters if woocommerce_no_products_found is false.

Aside from that, the problem you’re running into is that you are adding your myhelp action to the woocommerce_no_products_found hook. That means your function will only run when that hook fires – and it doesn’t fire when wp_head fires, it’s much later. That’s why your code isn’t injecting itself into the head.