How to count the number of checked Checkboxes with Rules? I have a Drupal Commerce site which uses user points (= coins) for paying.

I have a special case - the product, which the user should buy with his/her coins, needs some fields filled out by the user. So I used a content type for this case and when the user adds a new one, 10 coins will be reduced from the user's account - this works already fine.

Now I have also a taxonomy in this content type and the user can add terms to it, which are shown later in the form when the user fills it.

Problem :

I need to count how many checkboxes of the taxonomy terms are checked and multiply the costs with them. So if 3 of 5 are checked, then 10 coins * 3 = 30 coins will be the final price when the user adds a new content type.

Is this possible with Rules? I have no clue how to realize that
(I´m front-end developer and no PHP coder).
Yes this is perfectly possible with Rules, and you don't need any PHP to get the job done. In your case, the crucial part of such rule is a Rules Action to perform a Loop. If you're not familiar with such loops, then I strongly recommend to have a look at the tutorial titled "Lists and loops".

In your case, you should use (at least) these Rules Actions:


"Add a variable" (say with a machine name like nr_of_checked_terms), with initial value "0".
Add a loop related to your taxonomy terms. After you do, you should iterate over each item in that list (= each taxonomy term). And for each iteration you should then perform a Rules Action to "Set a data value", whereas you actually increment the value of nr_of_checked_terms with "1".


After the loop finished, the value of nr_of_checked_terms will be the actual number of terms that were checked. Just add another Rules Action near the end to do your actual multiplication using nr_of_checked_terms as one of the available tokens.

Done

PS 1: Refer to my answer to "How to set multiple values to an unlimited Term Refence field with Rules" for some sample rules that are like a variation of your question here.

PS 2: I assume this is about D7 ...