Automattic\WooCommerce\StoreApi\Schemas\V1
ProductCollectionDataSchema::get_item_response
Format data.
Метод класса: ProductCollectionDataSchema{}
Хуков нет.
Возвращает
Массив.
Использование
$ProductCollectionDataSchema = new ProductCollectionDataSchema(); $ProductCollectionDataSchema->get_item_response( $data );
- $data(массив) (обязательный)
- Collection data to format and return.
Код ProductCollectionDataSchema::get_item_response() ProductCollectionDataSchema::get item response WC 10.9.4
public function get_item_response( $data ) {
return [
'price_range' => ! is_null( $data['min_price'] ) && ! is_null( $data['max_price'] ) ? (object) $this->prepare_currency_response(
[
'min_price' => $this->prepare_money_response( $data['min_price'], wc_get_price_decimals() ),
'max_price' => $this->prepare_money_response( $data['max_price'], wc_get_price_decimals() ),
]
) : null,
'attribute_counts' => $data['attribute_counts'],
'rating_counts' => $data['rating_counts'],
'stock_status_counts' => $data['stock_status_counts'],
'taxonomy_counts' => $data['taxonomy_counts'],
];
}