{ "rules_assign_new_role_to_customer" : { "LABEL" : "Assign new role to customer", "PLUGIN" : "reaction rule", "WEIGHT" : "3", "REQUIRES" : [ "commerce_order", "commerce_payment", "rules", "commerce_checkout" ], "ON" : [ "commerce_checkout_complete", "commerce_payment_order_paid_in_full" ], "IF" : [ { "commerce_order_contains_product" : { "commerce_order" : [ "commerce_order" ], "product_id" : "20131001", "operator" : "=", "value" : "1" } }, { "commerce_payment_order_balance_comparison" : { "commerce_order" : [ "commerce_order" ], "value" : "0" } } ], "DO" : [ { "entity_query" : { "USING" : { "type" : "user", "property" : "mail", "value" : [ "commerce-order:mail" ], "limit" : "1" }, "PROVIDE" : { "entity_fetched" : { "account_fetched" : "Fetched account" } } } }, { "LOOP" : { "USING" : { "list" : [ "account-fetched" ] }, "ITEM" : { "list_item" : "Current list item" }, "DO" : [ { "user_add_role" : { "account" : [ "list-item" ], "roles" : { "value" : { "3" : "3" } } } } ] } } ] } }