"attaching the test to the AddtoCart function in the cart definition,"
Im not sure why that would be any cleaner than adding the notice beside the item, on the catalog page.
Im sure it would be possible to send a javascript alert, but would take custom coding to accomplish, this sort of customization is beyond the scope of the public forum, we could help implement this in a premiere incident:
webassist.com/premier_request.php