# woocommerce-pos/1.10.2/includes/API/V1/Traits/Uuid_Handler.php

WCPOS – Point of Sale (POS) plugin for WooCommerce, version 1.10.2. 77 lines.

- Page: https://pluginprobe.com/plugins/woocommerce-pos/1.10.2/code/includes/API/V1/Traits/Uuid_Handler.php
- Raw: https://pluginprobe.com/plugins/woocommerce-pos/1.10.2/raw/includes/API/V1/Traits/Uuid_Handler.php
- Modified: 2026-08-25T07:52:20+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woocommerce-pos/1.10.2/code/includes/API/V1/Traits/Uuid_Handler.php#L10-L20`.

```php
<?php
/**
 * Uuid_Handler.
 *
 * @package WCPOS\WooCommercePOS
 */

namespace WCPOS\WooCommercePOS\API\V1\Traits;

use WC_Abstract_Order;
use WC_Data;
use WC_Order_Item;
use WCPOS\WooCommercePOS\Sync\Pos_Uuid;
use WP_User;

/**
 * Trait Uuid_Handler.
 *
 * Ensures each WooCommerce record (products, orders, customers etc)
 * has a consistent unique UUID stored in the database.
 */
trait Uuid_Handler {
	/**
	 * Make sure the WC Data Object has a UUID.
	 *
	 * @param WC_Data $object The WooCommerce data object.
	 * @return void
	 */
	private function maybe_add_post_uuid( WC_Data $object ): void {
		$collides = $object instanceof WC_Abstract_Order
			? array( 'WCPOS\\WooCommercePOS\\Sync\\Pos_Uuid', 'uuid_owned_by_other_order' )
			: array( 'WCPOS\\WooCommercePOS\\Sync\\Pos_Uuid', 'uuid_owned_by_other' );

		Pos_Uuid::ensure_uuid( $object, array( 'collides' => $collides ) );
	}

	/**
	 * Ensure the WP_User has a valid UUID.
	 *
	 * @param WP_User $user The WordPress user object.
	 * @return void
	 */
	private function maybe_add_user_uuid( WP_User $user ): void {
		Pos_Uuid::ensure_user_uuid( $user );
	}

	/**
	 * Ensure the WC_Order_Item has a valid UUID.
	 *
	 * @param WC_Order_Item $item The order item object.
	 * @return void
	 */
	private function maybe_add_order_item_uuid( WC_Order_Item $item ): void {
		Pos_Uuid::ensure_order_item_uuid( $item );
	}

	/**
	 * Ensure the term has a valid UUID and return it.
	 *
	 * @param object $term The term object.
	 * @return string
	 */
	private function get_term_uuid( $term ): string {
		return Pos_Uuid::ensure_term_uuid( $term );
	}

	/**
	 * Retrieve order IDs by UUID.
	 *
	 * @param string $uuid The UUID to search for.
	 * @return array
	 */
	private function get_order_ids_by_uuid( string $uuid ) {
		return Pos_Uuid::get_order_ids_by_uuid( $uuid );
	}
}

```
