How do I sell points using a new product type? With the Drupal commerce module, I created a new product type I use for selling points to my customers. The product has a custom field named “points” (field type integer) where I specify the amount of point to sell.

On checkout I want to grant the points to the user (with the Userpoint module). I want to do this with rules. 

The problem is that I can’t retrieve the field “points” in action rules. I tried adding the “entity has field” condition, but I am not able to retrieve the field from the commerce order.

The action is grants points to a user.


  


How can I achieve this?
To answer your question in order to give you a solution. That people can "top" up here is maybe an alternative.

Drupal Userpoint Feature request


  Remember to use dev version.


Commerce Userpoints

What about something like this ? 


1) Rule


Event: on payment completed
Action: loop through the order line-items. Each line-item has an action to call the next component with parameters of order and the line-item.


2) Component


Parameters: order, line-item
Condition: data comparison line-item:type is Product (to expose line-item:commerce-product)
Action: call next component with parameters of order and line-item:commerce-product


3) Component


Parameters: order, product
Condition: data comparison product:type is Product (to expose the product:field-points-to-add)


Action: add userpoints, number to add being
product:field-points-to-add