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

ProductAttribute::getpublic staticWC 1.0

Method of the class: ProductAttribute{}

No Hooks.

Returns

null. Nothing (null).

Usage

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

ProductAttribute::get() code WC 10.9.1

public static function get(): ObjectType {
	if ( null === self::$instance ) {
		self::$instance = new ObjectType(
			array(
				'name'        => 'ProductAttribute',
				'description' => __( 'A product attribute.', 'woocommerce' ),
				'fields'      => fn() => array(
					'name'        => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'The attribute display name.', 'woocommerce' ),
					),
					'slug'        => array(
						'type'        => Type::nonNull( Type::string() ),
						'description' => __( 'The attribute taxonomy or key name.', 'woocommerce' ),
					),
					'options'     => array(
						'type'        => Type::nonNull( Type::listOf( Type::nonNull( Type::string() ) ) ),
						'description' => __( 'The available attribute values.', 'woocommerce' ),
					),
					'position'    => array(
						'type'        => Type::nonNull( Type::int() ),
						'description' => __( 'The display order position.', 'woocommerce' ),
					),
					'visible'     => array(
						'type'        => Type::nonNull( Type::boolean() ),
						'description' => __( 'Whether the attribute is visible on the product page.', 'woocommerce' ),
					),
					'variation'   => array(
						'type'        => Type::nonNull( Type::boolean() ),
						'description' => __( 'Whether the attribute is used for variations.', 'woocommerce' ),
					),
					'is_taxonomy' => array(
						'type'        => Type::nonNull( Type::boolean() ),
						'description' => __( 'Whether the attribute is a global taxonomy attribute.', 'woocommerce' ),
					),
				),
			)
		);
	}
	return self::$instance;
}