WC_Template_Loader::init
Hook in methods.
Method of the class: WC_Template_Loader{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Template_Loader::init();
WC_Template_Loader::init() WC Template Loader::init code WC 10.5.0
public static function init() {
self::$theme_support = wc_current_theme_supports_woocommerce_or_fse();
self::$shop_page_id = wc_get_page_id( 'shop' );
// Supported themes.
if ( self::$theme_support ) {
add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );
add_filter( 'comments_template', array( __CLASS__, 'comments_template_loader' ) );
// Loads gallery scripts on Product page for FSE themes.
if ( wp_is_block_theme() ) {
self::add_support_for_product_page_gallery();
}
} else {
// Unsupported themes.
add_action( 'template_redirect', array( __CLASS__, 'unsupported_theme_init' ) );
}
}