Automattic\WooCommerce\Internal\POS

Capabilities::get_pos_preset │ public static │ WC 11.0.0

Resolve the assigned POS preset for a user, or null if none is set.

Returns the woocommerce_pos_preset meta value only if it matches an assignable preset, so a stale or hand-edited value reads as "no preset".

The meta is stored per-site (see set_pos_preset()) so it stays aligned with the blog-scoped POS capabilities on multisite.

Method of the class: Capabilities{}

No Hooks.

Returns

string|null. One of the POSPreset constants, or null.

Usage

$result = Capabilities::get_pos_preset( $user_id ): ?string;
$user_id(int) (required)
Target user.

Changelog

Since 11.0.0 Introduced.

Capabilities::get_pos_preset() code WC 11.1.2

public static function get_pos_preset( int $user_id ): ?string {
	$meta = Users::get_site_user_meta( $user_id, self::POS_PRESET_META_KEY, true );
	if ( in_array( $meta, POSPreset::get_all(), true ) ) {
		return (string) $meta;
	}
	return null;
}