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

ProductAttribute{}WC 1.0

No Hooks.

Usage

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

Methods

  1. public static get()

ProductAttribute{} code WC 10.9.1

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

	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;
	}
}