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

VariableProduct::getpublic staticWC 1.0

Method of the class: VariableProduct{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

VariableProduct::get() code WC 10.9.1

public static function get(): ObjectType {
	if ( null === self::$instance ) {
		self::$instance = new ObjectType(
			array(
				'name'        => 'VariableProduct',
				'description' => __( 'A variable product with variations.', 'woocommerce' ),
				'interfaces'  => fn() => array(
					ProductInterface::get(),
				),
				'fields'      => fn() => array(
					'variations'        => array(
						'type'        => Type::nonNull( ProductVariationConnectionType::get() ),
						'description' => __( 'The product variations.', 'woocommerce' ),
						'args'        => array(
							'first'  => array(
								'type'         => Type::int(),
								'defaultValue' => null,
								'description'  => __( 'Return the first N results. Must be between 0 and 100.', 'woocommerce' ),
							),
							'last'   => array(
								'type'         => Type::int(),
								'defaultValue' => null,
								'description'  => __( 'Return the last N results. Must be between 0 and 100.', 'woocommerce' ),
							),
							'after'  => array(
								'type'         => Type::string(),
								'defaultValue' => null,
								'description'  => __( 'Return results after this cursor.', 'woocommerce' ),
							),
							'before' => array(
								'type'         => Type::string(),
								'defaultValue' => null,
								'description'  => __( 'Return results before this cursor.', 'woocommerce' ),
							),
						),
						'complexity'  => ResolverHelpers::complexity_from_pagination( ... ),
						'resolve'     => fn( $parent, array $args ): Connection => ResolverHelpers::translate_exceptions( fn() => $parent->variations->slice( $args ) ),
					),
					'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;
}