I have 3 products: A, B and C. After the user buy the product A, I want to give the user 5 points, for B 10 points and C 20 points.

How do I do this with rules?

1 Answer 1

  • Add a new rule with some name, e.g - Award Userpoint for Product A.
  • In event select "Completing the checkout process".
  • If you want to award userpoint only if payment has been done in full, then after going forward delete the "Completing the checkout process" & add another action "When an order is first paid in full".
  • Add condition "Order contains a particular product", put the SKU of the product A. User operator & quantity as per your requirement.
  • Add a action named "Grant points to a user", in data selector choose "commerce-order:owner" & set the points which you want to award.

Done...this is how I am doing.

  • Excellent, it worked! But there is some issue... If I buy 2 twice the product A, the system only gives me 5 points and should be 10 points. How do I do that? Jun 4, 2013 at 3:34
  • @JoseDaniel - I will see what options we have in there. Please accept the answer first as it solves the question which you asked...
    – RajeevK
    Jun 4, 2013 at 5:31
  • @JoseDaniel - Though I don't see any direct method but as per my understanding you can use rules_conditional module to put action in loops. So you will have to add a loop in action & inside that loop work on granting points to user. I guess loop will run equal to number of items..
    – RajeevK
    Jun 4, 2013 at 6:05
  • @JoseDaniel - You can try it & let me know if it works..
    – RajeevK
    Jun 4, 2013 at 6:06
  • Thanks for your help. I was planning do another calculation with the points, so I decided to change rules for hook_commerce_checkout_complete. I posted another question, maybe you can give some directions: drupal.stackexchange.com/questions/75234/… Thanks! Jun 5, 2013 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.