I'm trying to grant a user a premium role after completing the payment process but the rules are executed only from localhost. On the Server, no rules are triggered.

Anyone have a solution ?

{ "rules_prestataire_gold_rule" : {
    "LABEL" : "Prestataire gold rule",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "commerce_payment", "commerce_checkout" ],
    "ON" : [ "commerce_payment_order_paid_in_full", "commerce_checkout_complete" ],
    "IF" : [
      { "user_has_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "4" : "4" } }
        }
      }
    ],
    "DO" : [
      { "user_add_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "7" : "7" } }
        }
      },
      { "user_remove_role" : {
          "account" : [ "site:current-user" ],
          "roles" : { "value" : { "4" : "4" } }
        }
      }
    ]
  }
}

Comments

rszrama’s picture

Category: bug » support
Status: Active » Closed (won't fix)

I doubt this has anything to do with Drupal Commerce or the rule exported above. It looks pretty straightforward to me - could be something as simple as having different role IDs on the live site vs. your localhost. I'd turn on the Rules debug log and see where it's failing.