Automattic\WooCommerce\Blocks

BlockTemplatesController::render_woocommerce_template_part()publicWC 1.0

Renders the core/template-part block on the server.

Method of the class: BlockTemplatesController{}

No Hooks.

Return

String. The render.

Usage

$BlockTemplatesController = new BlockTemplatesController();
$BlockTemplatesController->render_woocommerce_template_part( $attributes );
$attributes(array) (required)
The block attributes.

BlockTemplatesController::render_woocommerce_template_part() code WC 9.4.2

public function render_woocommerce_template_part( $attributes ) {
	if ( isset( $attributes['theme'] ) && 'woocommerce/woocommerce' === $attributes['theme'] ) {
		$template_part = get_block_template( $attributes['theme'] . '//' . $attributes['slug'], 'wp_template_part' );

		if ( $template_part && ! empty( $template_part->content ) ) {
			return do_blocks( $template_part->content );
		}
	}
	return function_exists( '\gutenberg_render_block_core_template_part' ) ? \gutenberg_render_block_core_template_part( $attributes ) : \render_block_core_template_part( $attributes );
}