Automattic\WooCommerce\StoreApi\Schemas\V1

ProductBrandSchema::get_item_responsepublicWC 1.0

Convert a term object into an object suitable for the response.

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

Хуков нет.

Возвращает

Массив.

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

$ProductBrandSchema = new ProductBrandSchema();
$ProductBrandSchema->get_item_response( $term );
$term(WP_Term) (обязательный)
Term object.

Код ProductBrandSchema::get_item_response() WC 9.9.5

public function get_item_response( $term ) {
	$response = parent::get_item_response( $term );
	$count    = get_term_meta( $term->term_id, 'product_count_product_brand', true );

	if ( $count ) {
		$response['count'] = (int) $count;
	}

	$response['image']        = $this->image_attachment_schema->get_item_response( get_term_meta( $term->term_id, 'thumbnail_id', true ) );
	$response['review_count'] = $this->get_brand_review_count( $term );
	$response['permalink']    = get_term_link( $term->term_id, 'product_brand' );

	return $response;
}