I'm trying to award some User Points to users who select a certain plan during his checkout process.
Here is the explanation of my website functionality.
- When a user register with a role, the user will get access to the website with certain functionality.
- Some users will be having permission to create new nodes.
- During the node creation, the user needs to select a plan (I'm using
Commerce Node Checkout
module to add product as plan). - Based on the user's selection, the user will be redirected to the checkout page.
- After completion of the checkout process, the user will receive some User Points. For this I have created a rule, but it is not working as expected.
Here is the export of my rule:
{ "rules_per_day" : {
"LABEL" : "Per day",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "per day" ],
"REQUIRES" : [ "commerce_order", "userpoints_rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
{ "commerce_order_contains_product" : {
"commerce_order" : [ "site:current-cart-order" ],
"product_id" : "day_4dxivfX2oFRAqQH-Ij6VBFnBheZBRIo744cF46KKPSI",
"operator" : "=",
"value" : "1"
}
}
],
"DO" : [
{ "userpoints_action_grant_points" : {
"user" : [ "site:current-user" ],
"points" : "50",
"tid" : "0",
"entity" : [ "commerce-order" ],
"description" : "You have received the points for selected plan.",
"operation" : "Insert",
"display" : 1,
"moderate" : "approved"
}
}
]
}
}
The Rules Condition checks whether the order contains a specific product withe the product id n
.
I don't understand what I did wrong or what I have missed in this rule. Any suggestions to make this rule work?
n
.