The WooCommerce file that defines its pluggable functions isn’t loaded until after themes are loaded. It does this by hooking a function that includes the file into the after_setup_theme
hook:
add_action( 'after_setup_theme', array( $this, 'include_template_functions' ), 11 );
That’s from the /includes/class-woocommerce.php
file in WooCommerce. The include_template_functions()
function includes the file that defines functions like woocommerce_template_loop_add_to_cart()
.