This code adds conditional order restrictions at checkout so only customers with specific email addresses can purchase a specific product. If the customers billing email address doesn’t match, they cannot complete the purchase and a customizable notice is displayed like this :
The code enables the store owner to restrict customers from checkout by :
- Specific product ids
- Unlimited billing email addresses
Install as a new plugin or copy & paste the PHP code to the end of your child themes functions file or custom functionality plugin.
Swap out the product ID on line 17 and 26.
Swap out a comma separated list of email addresses on line 44.
These solutions may also help :