WC_Product_Data_Store_CPT::read_extra_data()protectedWC 3.0.0

Read extra data associated with the product, like button text or product URL for external products.

Метод класса: WC_Product_Data_Store_CPT{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->read_extra_data( $product );
$product(WC_Product) (обязательный) (передается по ссылке — &)
Product object.

Список изменений

С версии 3.0.0 Введена.

Код WC_Product_Data_Store_CPT::read_extra_data() WC 8.7.0

protected function read_extra_data( &$product ) {
	foreach ( $product->get_extra_data_keys() as $key ) {
		$function = 'set_' . $key;
		if ( is_callable( array( $product, $function ) ) ) {
			$product->{$function}( get_post_meta( $product->get_id(), '_' . $key, true ) );
		}
	}
}