Wordpress - 模板文件中没有全局$ wp_query

I'm working within a child theme on a WooCommerce template page called archive-product.php, and var_dump($wp_query) and it returns NULL.

Question: Is this behavior typical?

(From my experience it should already be initialized by this point.)

if you want to load anything you need to define - global $post; at the top of the file and then you can use $wp_query

Try below code :

add_action('init','your_func');function my_func(){
    global $wp_query;
    var_dump($wp_query);
    // or  var_dump($GLOBALS['wp_query']);
}