Minimum purchase in store

Hoping there is an easy answer to my question. I have four widgets in my store:

  1. can be purchased by itself, an infinite number of times
  2. minimum number sold is 5, but can increment by 1 after that
  3. can be applied to the same minimum count as #2 (#2x3 + #3x2 is valid); both combined must be above minimum
  4. can only be purchased once

I’ve been browsing the API docs but I’m not entirely clear where I enforce this business logic. Is this tied to the item itself, in the cart, or during pay? Any assistance would be greatly appreciated!

if (cart total > x) {disable checkout button; show error}