Automattic\WooCommerce\Admin\API

Products::get_item_schema()publicWC 1.0

Adds properties that can be embed via ?_embed=1.

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

Хуков нет.

Возвращает

Массив.

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

$Products = new Products();
$Products->get_item_schema();

Код Products::get_item_schema() WC 8.7.0

public function get_item_schema() {
	$schema = parent::get_item_schema();

	$properties_to_embed = array(
		'id',
		'name',
		'slug',
		'permalink',
		'images',
		'description',
		'short_description',
	);

	foreach ( $properties_to_embed as $property ) {
		$schema['properties'][ $property ]['context'][] = 'embed';
	}

	$schema['properties']['last_order_date'] = array(
		'description' => __( "The date the last order for this product was placed, in the site's timezone.", 'woocommerce' ),
		'type'        => 'date-time',
		'context'     => array( 'view', 'edit' ),
		'readonly'    => true,
	);

	return $schema;
}