WooCommerce Code Reference

Packages
in package

Packages class.

Tags
since
3.7.0

Table of Contents

$merged_packages  : array<string|int, mixed>
Array of package names and their main package classes.
$packages  : array<string|int, mixed>
Array of package names and their main package classes. Once a package has been merged into WooCommerce directly it should be removed from here and added to the merged packages array.
init()  : mixed
Init the package loader.
on_init()  : mixed
Callback for WordPress init hook.
package_exists()  : bool
Checks a package exists by looking for it's directory.
deactivate_merged_packages()  : mixed
Deactivates merged feature plugins.
initialize_packages()  : mixed
Loads packages after plugins_loaded hook.
missing_package()  : mixed
If a package is missing, add an admin notice.
__construct()  : mixed
Static-only class.

Properties

$merged_packages

Array of package names and their main package classes.

protected static array<string|int, mixed> $merged_packages = array('woocommerce-admin' => '\Automattic\WooCommerce\Admin\Composer\Package', 'woocommerce-gutenberg-products-block' => '\Automattic\WooCommerce\Blocks\Package')

One a package has been merged into WooCommerce Core it should be moved fron the package list and placed in this list. This will ensure that the feature plugin is disabled as well as provide the class to handle initialization for the now-merged feature plugin.

Once a package has been merged into WooCommerce Core it should have its slug added here. This will ensure that we deactivate the feature plugin automaticatlly to prevent any problems caused by conflicts between the two versions caused by them both being active.

$packages

Array of package names and their main package classes. Once a package has been merged into WooCommerce directly it should be removed from here and added to the merged packages array.

protected static array<string|int, mixed> $packages = array()

Methods

init()

Init the package loader.

public static init() : mixed
Tags
since
3.7.0
Return values
mixed

on_init()

Callback for WordPress init hook.

public static on_init() : mixed
Return values
mixed

package_exists()

Checks a package exists by looking for it's directory.

public static package_exists(string $package) : bool
Parameters
$package : string

Package name.

Return values
bool

deactivate_merged_packages()

Deactivates merged feature plugins.

protected static deactivate_merged_packages() : mixed

Once a feature plugin is merged into WooCommerce Core it should be deactivated. This method will ensure that a plugin gets deactivated. Note that for the first request it will still be active, and as such, there may be some odd behavior. This is unlikely to cause any issues though because it will be deactivated on the request that updates or activates WooCommerce.

Return values
mixed

initialize_packages()

Loads packages after plugins_loaded hook.

protected static initialize_packages() : mixed

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

Return values
mixed

missing_package()

If a package is missing, add an admin notice.

protected static missing_package(string $package) : mixed
Parameters
$package : string

Package name.

Return values
mixed

__construct()

Static-only class.

private __construct() : mixed
Return values
mixed