Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Output

ProductReview{}WC 1.0

No Hooks.

Usage

$ProductReview = new ProductReview();
// use class methods

Methods

  1. public static get()

ProductReview{} code WC 10.9.1

class ProductReview {
	private static ?ObjectType $instance = null;

	public static function get(): ObjectType {
		if ( null === self::$instance ) {
			self::$instance = new ObjectType(
				array(
					'name'        => 'ProductReview',
					'description' => __( 'Represents a customer review for a product.', 'woocommerce' ),
					'fields'      => fn() => array(
						'id'           => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'The review ID.', 'woocommerce' ),
						),
						'product_id'   => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'The product ID this review belongs to.', 'woocommerce' ),
						),
						'reviewer'     => array(
							'type'        => Type::nonNull( Type::string() ),
							'description' => __( 'The reviewer name.', 'woocommerce' ),
						),
						'review'       => array(
							'type'        => Type::nonNull( Type::string() ),
							'description' => __( 'The review content.', 'woocommerce' ),
						),
						'rating'       => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'The review rating (1-5).', 'woocommerce' ),
						),
						'date_created' => array(
							'type'        => DateTimeType::get(),
							'description' => __( 'The date the review was created.', 'woocommerce' ),
						),
					),
				)
			);
		}
		return self::$instance;
	}
}