Automattic\WooCommerce\Blocks

BlockTypesController::register_block_categories()publicWC 1.0

Register block categories

Used in combination with the block_categories_all to append WooCommerce Blocks related categories to the Gutenberg editor.

Method of the class: BlockTypesController{}

No Hooks.

Return

null. Nothing (null).

Usage

$BlockTypesController = new BlockTypesController();
$BlockTypesController->register_block_categories( $categories );
$categories(array) (required)
The array of already registered categories.

BlockTypesController::register_block_categories() code WC 9.4.2

public function register_block_categories( $categories ) {
	$woocommerce_block_categories = array(
		array(
			'slug'  => 'woocommerce',
			'title' => __( 'WooCommerce', 'woocommerce' ),
		),
		array(
			'slug'  => 'woocommerce-product-elements',
			'title' => __( 'WooCommerce Product Elements', 'woocommerce' ),
		),
	);

	return array_merge( $categories, $woocommerce_block_categories );
}