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

ProductVariation::getpublic staticWC 1.0

Method of the class: ProductVariation{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = ProductVariation::get(): ObjectType;

ProductVariation::get() code WC 10.9.1

public static function get(): ObjectType {
	if ( null === self::$instance ) {
		self::$instance = new ObjectType(
			array(
				'name'        => 'ProductVariation',
				'description' => __( 'A product variation.', 'woocommerce' ),
				'interfaces'  => fn() => array(
					ProductInterface::get(),
				),
				'fields'      => fn() => array(
					'parent_id'           => array(
						'type'        => Type::nonNull( Type::int() ),
						'description' => __( 'The parent variable product ID.', 'woocommerce' ),
					),
					'selected_attributes' => array(
						'type'        => Type::nonNull( Type::listOf( Type::nonNull( SelectedAttribute::get() ) ) ),
						'description' => __( 'The selected attribute values for this variation.', 'woocommerce' ),
					),
					'name'                => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'The product name.', 'woocommerce' ),
					),
					'slug'                => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'The product slug.', 'woocommerce' ),
					),
					'sku'                 => array(
						'type'        => Type::string(),
						'description' => __( 'The product SKU.', 'woocommerce' ),
					),
					'description'         => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'The full product description.', 'woocommerce' ),
					),
					'short_description'   => array(
						'type'              => Type::nonNull( Type::string() ),
						'description'       => __( 'The short product description.', 'woocommerce' ),
						'deprecationReason' => 'Use description instead.',
					),
					'status'              => array(
						'type'        => Type::nonNull( ProductStatusType::get() ),
						'description' => __( 'The product status.', 'woocommerce' ),
					),
					'raw_status'          => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'The raw status as stored in WordPress. Useful when status is OTHER (e.g. plugin-added post statuses).', 'woocommerce' ),
					),
					'product_type'        => array(
						'type'        => Type::nonNull( ProductTypeType::get() ),
						'description' => __( 'The product type.', 'woocommerce' ),
					),
					'raw_product_type'    => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'The raw product type as stored in WooCommerce. Useful when product_type is OTHER (e.g. plugin-added types like subscription, bundle).', 'woocommerce' ),
					),
					'regular_price'       => array(
						'type'        => Type::string(),
						'description' => __( 'The regular price of the product. Null when not set.', 'woocommerce' ),
						'args'        => array(
							'formatted' => array(
								'type'         => Type::boolean(),
								'defaultValue' => true,
								'description'  => __( 'Whether to apply currency formatting.', 'woocommerce' ),
							),
						),
					),
					'sale_price'          => array(
						'type'        => Type::string(),
						'description' => __( 'The sale price of the product.', 'woocommerce' ),
						'args'        => array(
							'formatted' => array(
								'type'         => Type::boolean(),
								'defaultValue' => true,
								'description'  => __( 'When true, returns price with currency symbol.', 'woocommerce' ),
							),
						),
					),
					'stock_status'        => array(
						'type'        => Type::nonNull( StockStatusType::get() ),
						'description' => __( 'The stock status of the product.', 'woocommerce' ),
					),
					'raw_stock_status'    => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'The raw stock status as stored in WooCommerce. Useful when stock_status is OTHER (e.g. plugin-added statuses).', 'woocommerce' ),
					),
					'stock_quantity'      => array(
						'type'        => Type::int(),
						'description' => __( 'The number of items in stock.', 'woocommerce' ),
					),
					'dimensions'          => array(
						'type'        => ProductDimensions::get(),
						'description' => __( 'The product dimensions.', 'woocommerce' ),
					),
					'images'              => array(
						'type'        => Type::nonNull( Type::listOf( Type::nonNull( ProductImage::get() ) ) ),
						'description' => __( 'The product images.', 'woocommerce' ),
					),
					'attributes'          => array(
						'type'        => Type::nonNull( Type::listOf( Type::nonNull( ProductAttribute::get() ) ) ),
						'description' => __( 'The product attributes.', 'woocommerce' ),
					),
					'reviews'             => array(
						'type'        => Type::nonNull( ProductReviewConnectionType::get() ),
						'description' => __( 'Customer reviews for this product.', 'woocommerce' ),
					),
					'date_created'        => array(
						'type'        => DateTimeType::get(),
						'description' => __( 'The date the product was created.', 'woocommerce' ),
					),
					'date_modified'       => array(
						'type'        => DateTimeType::get(),
						'description' => __( 'The date the product was last modified.', 'woocommerce' ),
					),
					'id'                  => array(
						'type'        => Type::nonNull( Type::int() ),
						'description' => __( 'The unique numeric identifier.', 'woocommerce' ),
					),
				),
			)
		);
	}
	return self::$instance;
}