Vote up!
Vote down!

How to get the quantity of a line item in rules?

Hi everybody,

I want to sell a temporaly access. Technically the customer should buy a product with a quantity where the quantity of the product is the time (for example months) the user wants to have the access, let's say to a special high-valued information area :)

What I want to do is to give that user a role (which works by know) when the order was fully paid (which is the trigger for my rule). I check if my product is in the order - everything is fine. But where I have no success yet is the point when I want to calculate the period for which the customer should have the access/ the role. I simply do not get the quantity in rules by a single line item. From this I would like to calculate the day when the access period ends.

I use the the data selector and sometimes - for example when I use the rules action "Calculate a value" I can select the quantity with "commerce-order:commerce-line-items:0:quantity". But on other actions like "Set a value" I do not get the quantiy selector. Maybe I do not understand something basic in rules but maybe someone can help my?


Asked by: tobiberlin
on March 24, 2014

2 Answers

Vote up!
Vote down!

To clarify, are you giving your customer access to content, like a node, if you are within the time-period they purchased, and of a certain role?

So, if they bought a 6 month subscription in January, and we're in March, then they still have access?

Answer by: delta195
Posted: Mar 25, 2014