Rules: How to modify an existing condition programmatically I've been able to add a condition to an existing rule, but I can't find any documentation on how to modify an existing condition on a rule. The following code works for adding but I need to modify the one that already exists. Any ideas?:

$hk_delivery_rule = rules_config_load('commerce_shipping_service_hong_kong_delivery');

$hk_delivery_settings = array(
    'first_price:select' =&gt; 'commerce-order:commerce-order-total',
    'operator' =&gt; '&lt;',
    'second_price' =&gt; array(
      'amount' =&gt; $hk_threshold,
      'currency_code' =&gt; 'HKD'
    )

  );

$hk_delivery_rule-&gt;condition(rules_condition('commerce_price_compare_price', $hk_delivery_settings));
$hk_delivery_rule-&gt;save();
So turned out it was quite easy:

  $hk_delivery_rule = rules_config_load('commerce_shipping_service_hong_kong_delivery');

  foreach ($hk_delivery_rule-&gt;conditions() as $condition) {

    if (isset($condition-&gt;settings['second_price'])) {

      $condition-&gt;settings['second_price']['amount'] = $hk_threshold;

    }

  }

  $hk_delivery_rule-&gt;save();