WC_Structured_Data::generate_website_data()publicWC 1.0

Generates WebSite structured data.

Hooked into woocommerce_before_main_content hook.

{} It's a method of the class: WC_Structured_Data{}

Hooks from the method

Return

null. Nothing.

Usage

$WC_Structured_Data = new WC_Structured_Data();
$WC_Structured_Data->generate_website_data();

Code of WC_Structured_Data::generate_website_data() WC 6.7.0

public function generate_website_data() {
	$markup                    = array();
	$markup['@type']           = 'WebSite';
	$markup['name']            = get_bloginfo( 'name' );
	$markup['url']             = home_url();
	$markup['potentialAction'] = array(
		'@type'       => 'SearchAction',
		'target'      => home_url( '?s={search_term_string}&post_type=product' ),
		'query-input' => 'required name=search_term_string',
	);

	$this->set_data( apply_filters( 'woocommerce_structured_data_website', $markup ) );
}