Automattic\WooCommerce\Blocks\Templates

SingleProductTemplate::add_password_form()public staticWC 1.0

Add password form to the Single Product Template.

Method of the class: SingleProductTemplate{}

No Hooks.

Return

String.

Usage

$result = SingleProductTemplate::add_password_form( $content );
$content(string) (required)
The content of the template.

SingleProductTemplate::add_password_form() code WC 8.9.0

public static function add_password_form( $content ) {
	$parsed_blocks     = parse_blocks( $content );
	$blocks            = self::replace_first_single_product_template_block_with_password_form( $parsed_blocks, false );
	$serialized_blocks = serialize_blocks( $blocks['blocks'] );

	return $serialized_blocks;
}