WooCommerce Code Reference

Package
in package

Main package class.

Returns information about the package and handles init.

Tags
since
2.5.0

Table of Contents

$feature_gating  : FeatureGating
Holds the feature gating class instance.
$path  : string
Holds the main path to the blocks plugin directory.
$plugin_dir_url  : string
Holds locally the plugin_dir_url to avoid recomputing it.
$version  : string
Holds the current version of the blocks plugin.
__construct()  : mixed
Constructor
feature()  : FeatureGating
Returns an instance of the FeatureGating class.
get_path()  : string
Returns the path to the plugin directory.
get_url()  : string
Returns the url to the blocks plugin directory.
get_version()  : string
Returns the version of WooCommerce Blocks.
get_version_stored_on_db()  : string
Returns the version of WooCommerce Blocks stored in the database.
set_version_stored_on_db()  : mixed
Sets the version of WooCommerce Blocks in the database.

Properties

Methods

__construct()

Constructor

public __construct(string $version, string $plugin_path, FeatureGating $feature_gating) : mixed
Parameters
$version : string

Version of the plugin.

$plugin_path : string

Path to the main plugin file.

$feature_gating : FeatureGating

Feature gating class instance.

Return values
mixed

feature()

Returns an instance of the FeatureGating class.

public feature() : FeatureGating
Return values
FeatureGating

get_path()

Returns the path to the plugin directory.

public get_path([string $relative_path = '' ]) : string
Parameters
$relative_path : string = ''

If provided, the relative path will be appended to the plugin path.

Return values
string

get_url()

Returns the url to the blocks plugin directory.

public get_url([string $relative_url = '' ]) : string
Parameters
$relative_url : string = ''

If provided, the relative url will be appended to the plugin url.

Return values
string

get_version()

Returns the version of WooCommerce Blocks.

public get_version() : string

Note: since Blocks was merged into WooCommerce Core, the version of WC Blocks doesn't update anymore. Use Constants::get_constant( 'WC_VERSION' ) when possible to get the WooCommerce Core version.

Return values
string

get_version_stored_on_db()

Returns the version of WooCommerce Blocks stored in the database.

public get_version_stored_on_db() : string
Return values
string

set_version_stored_on_db()

Sets the version of WooCommerce Blocks in the database.

public set_version_stored_on_db() : mixed

This is useful during the first installation or after the upgrade process.

Return values
mixed