PHP 8.2.31
Preview: ProductCollectionDataSchema.php Size: 4.95 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/src/StoreApi/Schemas/V1/ProductCollectionDataSchema.php

<?php
namespace Automattic\WooCommerce\StoreApi\Schemas\V1;

/**
 * ProductCollectionDataSchema class.
 */
class ProductCollectionDataSchema extends AbstractSchema {
	/**
	 * The schema item name.
	 *
	 * @var string
	 */
	protected $title = 'product-collection-data';

	/**
	 * The schema item identifier.
	 *
	 * @var string
	 */
	const IDENTIFIER = 'product-collection-data';

	/**
	 * Product collection data schema properties.
	 *
	 * @return array
	 */
	public function get_properties() {
		return [
			'price_range'         => [
				'description' => __( 'Min and max prices found in collection of products, provided using the smallest unit of the currency.', 'woocommerce' ),
				'type'        => [ 'object', 'null' ],
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
				'properties'  => array_merge(
					$this->get_store_currency_properties(),
					[
						'min_price' => [
							'description' => __( 'Min price found in collection of products.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
						'max_price' => [
							'description' => __( 'Max price found in collection of products.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
					]
				),
			],
			'attribute_counts'    => [
				'description' => __( 'Returns number of products within attribute terms.', 'woocommerce' ),
				'type'        => [ 'array', 'null' ],
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
				'items'       => [
					'type'       => 'object',
					'properties' => [
						'term'  => [
							'description' => __( 'Term ID', 'woocommerce' ),
							'type'        => 'integer',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
						'count' => [
							'description' => __( 'Number of products.', 'woocommerce' ),
							'type'        => 'integer',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
					],
				],
			],
			'rating_counts'       => [
				'description' => __( 'Returns number of products with each average rating.', 'woocommerce' ),
				'type'        => [ 'array', 'null' ],
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
				'items'       => [
					'type'       => 'object',
					'properties' => [
						'rating' => [
							'description' => __( 'Average rating', 'woocommerce' ),
							'type'        => 'integer',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
						'count'  => [
							'description' => __( 'Number of products.', 'woocommerce' ),
							'type'        => 'integer',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
					],
				],
			],
			'stock_status_counts' => [
				'description' => __( 'Returns number of products with each stock status.', 'woocommerce' ),
				'type'        => [ 'array', 'null' ],
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
				'items'       => [
					'type'       => 'object',
					'properties' => [
						'status' => [
							'description' => __( 'Status', 'woocommerce' ),
							'type'        => 'string',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
						'count'  => [
							'description' => __( 'Number of products.', 'woocommerce' ),
							'type'        => 'integer',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
					],
				],
			],
			'taxonomy_counts'     => [
				'description' => __( 'Returns number of products within taxonomy terms.', 'woocommerce' ),
				'type'        => [ 'array', 'null' ],
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
				'items'       => [
					'type'       => 'object',
					'properties' => [
						'term'  => [
							'description' => __( 'Term ID', 'woocommerce' ),
							'type'        => 'integer',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
						'count' => [
							'description' => __( 'Number of products.', 'woocommerce' ),
							'type'        => 'integer',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
					],
				],
			],
		];
	}

	/**
	 * Format data.
	 *
	 * @param array $data Collection data to format and return.
	 * @return array
	 */
	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'],
		];
	}
}

Directory Contents

Dirs: 2 × Files: 28

Name Size Perms Modified Actions
Agentic DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
AI DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
10.58 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
12.97 KB lrw-r--r-- 2026-05-11 17:17:08
Edit Download
427 B lrw-r--r-- 2023-12-27 00:45:02
Edit Download
4.46 KB lrw-r--r-- 2024-04-30 19:35:34
Edit Download
2.98 KB lrw-r--r-- 2025-06-30 17:49:22
Edit Download
2.21 KB lrw-r--r-- 2024-08-27 23:04:44
Edit Download
2.12 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
7.54 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
17.07 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
11.37 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
752 B lrw-r--r-- 2023-12-27 00:45:02
Edit Download
15.05 KB lrw-r--r-- 2025-06-23 19:46:28
Edit Download
1.12 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
3.32 KB lrw-r--r-- 2026-03-30 17:12:24
Edit Download
11.27 KB lrw-r--r-- 2025-07-29 12:34:58
Edit Download
2.41 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
2.20 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
7.16 KB lrw-r--r-- 2026-02-23 17:58:34
Edit Download
12.86 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
673 B lrw-r--r-- 2024-10-21 23:53:16
Edit Download
2.50 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
3.49 KB lrw-r--r-- 2025-03-03 22:28:12
Edit Download
3.50 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
4.95 KB lrw-r--r-- 2025-07-29 12:34:58
Edit Download
6.12 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download
36.58 KB lrw-r--r-- 2026-05-05 14:26:50
Edit Download
2.84 KB lrw-r--r-- 2024-04-30 19:35:34
Edit Download
2.15 KB lrw-r--r-- 2023-12-27 00:45:02
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).