I am developing a solution for a client where I need to generate an incremental integer or unique string that will be inserted into multiple WooCommerce order as a custom post meta.
It's important that it's the value that is inserted into multiple orders.
I was looking at using wp_generate_uuid4()
, but it is not unique and it would be a big task to look every order up and check if it's been used before.
UPDATE: This has to be a separate value from the order ID, since I have to be able to generate the value, set the unique value for multiple orders.