Automattic\WooCommerce\Internal\Api\Autogenerated\GraphQLTypes\Input

UpdateCoupon{}WC 1.0

No Hooks.

Usage

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

Methods

  1. public array(
  2. public static get()
  3. public if ( null === self::$instance )

UpdateCoupon{} code WC 10.9.1

class UpdateCoupon {
	private static ?InputObjectType $instance = null;

	public static function get(): InputObjectType {
		if ( null === self::$instance ) {
			self::$instance = new InputObjectType(
				array(
					'name'        => 'UpdateCouponInput',
					'description' => __( 'Data for updating an existing coupon. All fields are optional.', 'woocommerce' ),
					'fields'      => fn() => array(
						'id'                          => array(
							'type'        => Type::nonNull( Type::int() ),
							'description' => __( 'The ID of the coupon to update.', 'woocommerce' ),
						),
						'code'                        => array(
							'type'        => Type::string(),
							'description' => __( 'The coupon code.', 'woocommerce' ),
						),
						'description'                 => array(
							'type'        => Type::string(),
							'description' => __( 'The coupon description.', 'woocommerce' ),
						),
						'discount_type'               => array(
							'type'        => DiscountTypeType::get(),
							'description' => __( 'The type of discount.', 'woocommerce' ),
						),
						'amount'                      => array(
							'type'        => Type::float(),
							'description' => __( 'The discount amount.', 'woocommerce' ),
						),
						'status'                      => array(
							'type'        => CouponStatusType::get(),
							'description' => __( 'The coupon status.', 'woocommerce' ),
						),
						'date_expires'                => array(
							'type'        => Type::string(),
							'description' => __( 'The date the coupon expires (ISO 8601).', 'woocommerce' ),
						),
						'individual_use'              => array(
							'type'        => Type::boolean(),
							'description' => __( 'Whether the coupon can only be used alone.', 'woocommerce' ),
						),
						'product_ids'                 => array(
							'type'        => Type::listOf( Type::nonNull( Type::int() ) ),
							'description' => __( 'Product IDs the coupon can be applied to.', 'woocommerce' ),
						),
						'excluded_product_ids'        => array(
							'type'        => Type::listOf( Type::nonNull( Type::int() ) ),
							'description' => __( 'Product IDs excluded from the coupon.', 'woocommerce' ),
						),
						'usage_limit'                 => array(
							'type'        => Type::int(),
							'description' => __( 'Maximum number of times the coupon can be used in total.', 'woocommerce' ),
						),
						'usage_limit_per_user'        => array(
							'type'        => Type::int(),
							'description' => __( 'Maximum number of times the coupon can be used per customer.', 'woocommerce' ),
						),
						'limit_usage_to_x_items'      => array(
							'type'        => Type::int(),
							'description' => __( 'Maximum number of items the coupon can be applied to.', 'woocommerce' ),
						),
						'free_shipping'               => array(
							'type'        => Type::boolean(),
							'description' => __( 'Whether the coupon grants free shipping.', 'woocommerce' ),
						),
						'product_categories'          => array(
							'type'        => Type::listOf( Type::nonNull( Type::int() ) ),
							'description' => __( 'Product category IDs the coupon applies to.', 'woocommerce' ),
						),
						'excluded_product_categories' => array(
							'type'        => Type::listOf( Type::nonNull( Type::int() ) ),
							'description' => __( 'Product category IDs excluded from the coupon.', 'woocommerce' ),
						),
						'exclude_sale_items'          => array(
							'type'        => Type::boolean(),
							'description' => __( 'Whether the coupon excludes items on sale.', 'woocommerce' ),
						),
						'minimum_amount'              => array(
							'type'        => Type::float(),
							'description' => __( 'Minimum order amount required to use the coupon.', 'woocommerce' ),
						),
						'maximum_amount'              => array(
							'type'        => Type::float(),
							'description' => __( 'Maximum order amount allowed to use the coupon.', 'woocommerce' ),
						),
						'email_restrictions'          => array(
							'type'        => Type::listOf( Type::nonNull( Type::string() ) ),
							'description' => __( 'Email addresses that can use this coupon.', 'woocommerce' ),
						),
					),
				)
			);
		}
		return self::$instance;
	}
}