WordPress at Your Fingertips
function is not described

WC_Structured_Data::get_structured_data() public WC 1.0

Structures and returns data.

List of types available by default for specific request:

'product', 'review', 'breadcrumblist', 'website', 'order',

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

Hooks from the method
Return

Array.

Usage

$WC_Structured_Data = new WC_Structured_Data();
$WC_Structured_Data->get_structured_data( $types );
$types(array) (required)
Structured data types.

Code of WC_Structured_Data::get_structured_data() WC 5.6.0

public function get_structured_data( $types ) {
	$data = array();

	// Put together the values of same type of structured data.
	foreach ( $this->get_data() as $value ) {
		$data[ strtolower( $value['@type'] ) ][] = $value;
	}

	// Wrap the multiple values of each type inside a graph... Then add context to each type.
	foreach ( $data as $type => $value ) {
		$data[ $type ] = count( $value ) > 1 ? array( '@graph' => $value ) : $value[0];
		$data[ $type ] = apply_filters( 'woocommerce_structured_data_context', array( '@context' => 'https://schema.org/' ), $data, $type, $value ) + $data[ $type ];
	}

	// If requested types, pick them up... Finally change the associative array to an indexed one.
	$data = $types ? array_values( array_intersect_key( $data, array_flip( $types ) ) ) : array_values( $data );

	if ( ! empty( $data ) ) {
		if ( 1 < count( $data ) ) {
			$data = apply_filters( 'woocommerce_structured_data_context', array( '@context' => 'https://schema.org/' ), $data, '', '' ) + array( '@graph' => $data );
		} else {
			$data = $data[0];
		}
	}

	return $data;
}