Automattic\WooCommerce\Internal\POS

POSPreset{}finalWC 11.0.0

Enum-style class for the assignable POS staff presets.

Presets are UI-curated bundles of woocommerce_pos_* capabilities (Cashier / Manager / Admin); see Capabilities::capabilities_for_preset(). Kept under the POS namespace rather than the shared Enums namespace because presets are a UI-level grouping that may change as the granular-caps model matures, not a stable store-wide vocabulary.

Constant class rather than a native PHP enum so it stays within WooCommerce's PHP 7.4 minimum.

No Hooks.

Usage

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

Methods

  1. public static get_all()

Changelog

Since 11.0.0 Introduced.

POSPreset{} code WC 11.0.0

final class POSPreset {
	/**
	 * Cashier preset.
	 *
	 * @var string
	 */
	public const CASHIER = 'pos_cashier';

	/**
	 * Manager preset.
	 *
	 * @var string
	 */
	public const MANAGER = 'pos_manager';

	/**
	 * Admin preset.
	 *
	 * @var string
	 */
	public const ADMIN = 'pos_admin';

	/**
	 * All assignable presets, in ascending capability order.
	 *
	 * @return string[]
	 *
	 * @since 11.0.0
	 */
	public static function get_all(): array {
		return array(
			self::CASHIER,
			self::MANAGER,
			self::ADMIN,
		);
	}
}