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

ExternalProduct{}WC 1.0

Хуков нет.

Использование

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

Методы

  1. public static get()

Код ExternalProduct{} WC 10.8.1

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

	public static function get(): ObjectType {
		if ( null === self::$instance ) {
			self::$instance = new ObjectType(
				array(
					'name'        => 'ExternalProduct',
					'description' => __( 'An external/affiliate product.', 'woocommerce' ),
					'interfaces'  => fn() => array(
						ProductInterface::get(),
					),
					'fields'      => fn() => array(
						'product_url'       => array(
							'type'        => Type::string(),
							'description' => __( 'The external product URL.', 'woocommerce' ),
						),
						'button_text'       => array(
							'type'        => Type::string(),
							'description' => __( 'The text for the external product button.', '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;
	}
}