Automattic\WooCommerce\Internal\Features\ProductBlockEditor\ProductTemplates

AbstractProductFormTemplate::get_section_by_idpublicWC 1.0

Get a section block by ID.

Method of the class: AbstractProductFormTemplate{}

No Hooks.

Returns

null. Nothing (null).

Usage

$AbstractProductFormTemplate = new AbstractProductFormTemplate();
$AbstractProductFormTemplate->get_section_by_id( $section_id ): ?SectionInterface;
$section_id(string) (required)
The section block ID.

AbstractProductFormTemplate::get_section_by_id() code WC 10.7.0

public function get_section_by_id( string $section_id ): ?SectionInterface {
	$section = $this->get_block( $section_id );
	if ( $section && ! $section instanceof SectionInterface ) {
		throw new \UnexpectedValueException( 'Block with specified ID is not a section.' );
	}
	return $section;
}