Automattic\WooCommerce

Packages::initialize_packages()protected staticWC 1.0

Loads packages after plugins_loaded hook.

Each package should include an init file which loads the package so it can be used by core.

Method of the class: Packages{}

Hooks from the method

Return

null. Nothing (null).

Usage

$result = Packages::initialize_packages();

Packages::initialize_packages() code WC 9.4.2

protected static function initialize_packages() {
	foreach ( self::get_enabled_packages() as $package_name => $package_class ) {
		call_user_func( array( $package_class, 'init' ) );
	}

	foreach ( self::$packages as $package_name => $package_class ) {
		if ( ! self::package_exists( $package_name ) ) {
			self::missing_package( $package_name );
			continue;
		}
		call_user_func( array( $package_class, 'init' ) );
	}

	// Proxies "activated_plugin" hook for embedded packages listen on WC plugin activation
	// https://github.com/woocommerce/woocommerce/issues/28697.
	if ( is_admin() ) {
		$activated_plugin = get_transient( 'woocommerce_activated_plugin' );
		if ( $activated_plugin ) {
			delete_transient( 'woocommerce_activated_plugin' );

			/**
			 * WooCommerce is activated hook.
			 *
			 * @since 5.0.0
			 * @param bool $activated_plugin Activated plugin path,
			 *                               generally woocommerce/woocommerce.php.
			 */
			do_action( 'woocommerce_activated_plugin', $activated_plugin );
		}
	}
}