Automattic\WooCommerce\Internal\Features\ProductBlockEditor\ProductTemplates

SimpleProductTemplate::add_variation_group_blocks()privateWC 1.0

Adds the variation group blocks to the template.

Метод класса: SimpleProductTemplate{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->add_variation_group_blocks();

Код SimpleProductTemplate::add_variation_group_blocks() WC 9.3.3

private function add_variation_group_blocks() {
	$variation_group = $this->get_group_by_id( $this::GROUP_IDS['VARIATIONS'] );
	if ( ! $variation_group ) {
		return;
	}

	$variation_group->add_section(
		array(
			'id'         => 'product-variation-options-section',
			'order'      => 10,
			'attributes' => array(
				'title'       => __( 'Variation options', 'woocommerce' ),
				'description' => __( 'Add and manage attributes used for product options, such as size and color.', 'woocommerce' ),
			),
		)
	)->add_block(
		array(
			'id'        => 'product-variation-options',
			'blockName' => 'woocommerce/product-variations-options-field',
			'order'     => 10,
		)
	);

	$variation_group->add_section(
		array(
			'id'         => 'product-variation-section',
			'order'      => 20,
			'attributes' => array(
				'title'       => __( 'Variations', 'woocommerce' ),
				'description' => __( 'Manage individual product combinations created from options.', 'woocommerce' ),
			),
		)
	)->add_block(
		array(
			'id'        => 'product-variation-items',
			'blockName' => 'woocommerce/product-variation-items-field',
			'order'     => 10,
		)
	);
}