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.
- 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.
- 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
- 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
The problem comes when the quantity of the products sold is more than 1 because the action loops only through
line-item and not through
Any suggestion for looping through