WordPress at a glance
function is not described


Assets::register_block_script() public WC 2.3.0

Queues a block script in the frontend.

{} It's a method of the class: Assets{}

No Hooks.


Null. Nothing.


$result = Assets::register_block_script( $script_name, $handle, $dependencies );
$script_name(string) (required)
Name of the script used to identify the file inside build folder.
Provided if the handle should be different than the script name. wc- prefix automatically added.
An array of registered script handles this script depends on.
Default: empty array


Since 2.3.0 Introduced.
Since 2.6.0 Changed $name to $script_name and added $handle argument.
Since 2.9.0 Made it so scripts are not loaded in admin pages.

Code of Assets::register_block_script() WC 5.0.0

public static function register_block_script( $script_name, $handle = '', $dependencies = [] ) {
	$asset_api = Package::container()->get( AssetApi::class );
	$asset_api->register_block_script( $script_name, $handle, $dependencies );