HEX
Server: LiteSpeed
System: Linux s383.bitcommand.com 5.14.0-687.24.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 9 18:14:06 EDT 2026 x86_64
User: pclast (1605)
PHP: 8.1.34
Disabled: exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/pclast/www/wp-content/plugins/woocommerce/src/Api/Types/Coupons/Coupon.php
<?php

declare(strict_types=1);

namespace Automattic\WooCommerce\Api\Types\Coupons;

use Automattic\WooCommerce\Api\Attributes\ArrayOf;
use Automattic\WooCommerce\Api\Attributes\Description;
use Automattic\WooCommerce\Api\Attributes\ScalarType;
use Automattic\WooCommerce\Api\Enums\Coupons\CouponStatus;
use Automattic\WooCommerce\Api\Enums\Coupons\DiscountType;
use Automattic\WooCommerce\Api\Interfaces\ObjectWithId;
use Automattic\WooCommerce\Api\Scalars\DateTime;

/**
 * Output type representing a WooCommerce coupon.
 */
#[Description( 'Represents a WooCommerce discount coupon.' )]
class Coupon {
	use ObjectWithId;

	#[Description( 'The coupon code.' )]
	public string $code;

	#[Description( 'The coupon description.' )]
	public string $description;

	#[Description( 'The type of discount.' )]
	public DiscountType $discount_type;

	#[Description( 'The raw discount type as stored in WooCommerce. Useful when discount_type is OTHER (e.g. plugin-added types like recurring_percent or sign_up_fee).' )]
	public string $raw_discount_type;

	#[Description( 'The discount amount.' )]
	public float $amount;

	#[Description( 'The coupon status.' )]
	public CouponStatus $status;

	#[Description( 'The raw status as stored in WordPress. Useful when status is OTHER (e.g. plugin-added post statuses).' )]
	public string $raw_status;

	#[Description( 'The date the coupon was created.' )]
	#[ScalarType( DateTime::class )]
	public ?string $date_created;

	#[Description( 'The date the coupon was last modified.' )]
	#[ScalarType( DateTime::class )]
	public ?string $date_modified;

	#[Description( 'The date the coupon expires.' )]
	#[ScalarType( DateTime::class )]
	public ?string $date_expires;

	#[Description( 'The number of times the coupon has been used.' )]
	public int $usage_count;

	#[Description( 'Whether the coupon can only be used alone.' )]
	public bool $individual_use;

	#[Description( 'Product IDs the coupon can be applied to.' )]
	#[ArrayOf( 'int' )]
	public array $product_ids;

	#[Description( 'Product IDs excluded from the coupon.' )]
	#[ArrayOf( 'int' )]
	public array $excluded_product_ids;

	#[Description( 'Maximum number of times the coupon can be used in total.' )]
	public int $usage_limit;

	#[Description( 'Maximum number of times the coupon can be used per customer.' )]
	public int $usage_limit_per_user;

	#[Description( 'Maximum number of items the coupon can be applied to.' )]
	public ?int $limit_usage_to_x_items;

	#[Description( 'Whether the coupon grants free shipping.' )]
	public bool $free_shipping;

	#[Description( 'Product category IDs the coupon applies to.' )]
	#[ArrayOf( 'int' )]
	public array $product_categories;

	#[Description( 'Product category IDs excluded from the coupon.' )]
	#[ArrayOf( 'int' )]
	public array $excluded_product_categories;

	#[Description( 'Whether the coupon excludes items on sale.' )]
	public bool $exclude_sale_items;

	#[Description( 'Minimum order amount required to use the coupon.' )]
	public float $minimum_amount;

	#[Description( 'Maximum order amount allowed to use the coupon.' )]
	public float $maximum_amount;

	#[Description( 'Email addresses that can use this coupon.' )]
	#[ArrayOf( 'string' )]
	public array $email_restrictions;

	#[Description( 'Email addresses of customers who have used this coupon.' )]
	#[ArrayOf( 'string' )]
	public array $used_by;
}