0

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.

z-designs
  • 69
  • 11
  • use order id as unique ? – Snuffy Nov 05 '21 at 10:41
  • 1
    Although you want to use the outcome of your question for WooCommerce purposes, the answer seems more like a pure PHP solution to me [How to generate a random, unique, alphanumeric string?](https://stackoverflow.com/questions/1846202/how-to-generate-a-random-unique-alphanumeric-string) -- [PHP: generate unique and random numbers/ IDs](https://stackoverflow.com/questions/4776553/php-generate-unique-and-random-numbers-ids) – 7uc1f3r Nov 05 '21 at 10:45

0 Answers0