woocommerce_blocks_loaded action-hookWC 2.5.0

Fires when the woocommerce blocks are loaded and ready to use.

This hook is intended to be used as a safe event hook for when the plugin has been loaded, and all dependency requirements have been met.

To ensure blocks are initialized, you must use the woocommerce_blocks_loaded instead of the plugins_loaded This is because the functions hooked into plugins_loaded on the same priority load in an inconsistent and unpredictable manner.

Usage

add_action( 'woocommerce_blocks_loaded', 'wp_kama_woocommerce_blocks_loaded_action' );

/**
 * Function for `woocommerce_blocks_loaded` action-hook.
 * 
 * @return void
 */
function wp_kama_woocommerce_blocks_loaded_action(){

	// action...
}

Changelog

Since 2.5.0 Introduced.

Where the hook is called

Bootstrap::__construct()
woocommerce_blocks_loaded
woocommerce/src/Blocks/Domain/Bootstrap.php 97
do_action( 'woocommerce_blocks_loaded' );

Where the hook is used in WooCommerce

woocommerce/src/Internal/Admin/WCAdminSharedSettings.php 35
add_action( 'woocommerce_blocks_loaded', array( $this, 'on_woocommerce_blocks_loaded' ), 10 );