I run an ecommerce site on top of wordpress.
There is a particular meta field that users fill out when they checkout with me. Let's say it is the address of the user.
I would like to setup my site such that, no two users can checkout/create accounts with the same address.
Very similar to the functionality built into wordpress such that no two users can have the same email. The only difference if that it would be based on a custom meta field on the user instead.
Or alternatively, another approach would be to run a custom php hook on checkout that will query all users on the site and see if any contain a matching meta field. From here I can reject the order & send an email to the user notifying them of the issue so I can followup and try to resolve the problem with them. Is there a way to query all users for a matching meta field that doesn't place a heavy load on the server? I was thinking I could make a separate database entry just for this meta-field so I can query it quickly, but I feel that might be over-engineering the issue.
Either two approaches could work.
Thanks so much for the advice!