Automattic\WooCommerce\Blocks\Templates

SingleProductTemplate::add_password_formpublic staticWC 1.0

Add password form to the Single Product Template.

Method of the class: SingleProductTemplate{}

No Hooks.

Returns

String.

Usage

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

SingleProductTemplate::add_password_form() code WC 9.9.4

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;
}