My objective is to build an commerce site that attributes 'tokens' (integer values) to products and than keeps a running total of the complete token value within the cart. The idea is to check against how many tokens the user has before allowing a purchase, allowing a product to be added to cart, etc. etc. So far my strategy has been to do this:
- Hook_entity_info_alter on the line item product type 'token-based-products' to add a persistent data field for the token value which is required and accessible within views. This seems pretty straight forward.
- My Question. How do I keep persistent data storage about tokens within the cart for validation? The objective for this is to create a few hooks that check the running total token value of the cart before allowing/disallowing a product being added AND before allowing products to be checked out.