Selling Per-Node Access with Drupal Commerce
This screencast builds on the previous screencast showing selling a role. This time, though, we're going to sell an individual node. Here's the recipe:
* We have Content Access and its submodule Content Access Rules enabled
* Create a content type called Premium Content
* Instead of granting access to that entire content type by role, grant it on a user-by-user, node-by-node basis
* Add a nodereference field to our product; each product that sells access to a node should have the nodereference set to the content in question.
* Add a rule (and component)
* When the order is updated
* If its state is Completed
* Loop through the line items (invoke a component)
* If the line item has a product reference field
* If the Product has a nodereference field
* Grant access to the node listed in the nodereference to the user who created the order.