WordPress at Your Fingertips
function is not described

WC_Structured_Data::set_data() public WC 1.0

Sets data.

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

No Hooks.

Return

true|false.

Usage

$WC_Structured_Data = new WC_Structured_Data();
$WC_Structured_Data->set_data( $data, $reset );
$data(array) (required)
Structured data.
$reset(true|false)
Unset data (default: false).
Default: false

Code of WC_Structured_Data::set_data() WC 5.8.0

public function set_data( $data, $reset = false ) {
	if ( ! isset( $data['@type'] ) || ! preg_match( '|^[a-zA-Z]{1,20}$|', $data['@type'] ) ) {
		return false;
	}

	if ( $reset && isset( $this->_data ) ) {
		unset( $this->_data );
	}

	$this->_data[] = $data;

	return true;
}