I'm doing something very simple. I have an order where rules fires on completed checkout.
I'm trying to iterate through the existing line items and schedule recurring billing based on a text list that has either yearly or monthly.
It wasn't working so I broke it down it its bases of elements in the actions.
Here is my exported rule:
{ "rules_schedule_next_billing_cloned_" : {
"LABEL" : "schedule next billing (cloned)",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_checkout" ],
"ON" : { "commerce_checkout_complete" : [] },
"IF" : [
{ "entity_has_field" : {
"entity" : [ "commerce-order:commerce-line-items:0" ],
"field" : "commerce_product"
}
},
{ "entity_has_field" : {
"entity" : [ "commerce-order:commerce-line-items:0:commerce-product" ],
"field" : "field_cycle_start"
}
},
{ "entity_has_field" : {
"entity" : [ "commerce-order:commerce-line-items:0:commerce-product" ],
"field" : "field_cycle_period_list"
}
},
{ "entity_has_field" : {
"entity" : [ "commerce-order:commerce-line-items:0:commerce-product" ],
"field" : "field_client"
}
},
{ "entity_is_of_bundle" : {
"entity" : [ "commerce-order:commerce-line-items:0:commerce-product" ],
"type" : "commerce_product",
"bundle" : { "value" : { "recurring_service" : "recurring_service" } }
}
}
],
"DO" : [
{ "LOOP" : {
"USING" : { "list" : [ "commerce-order:commerce-line-items" ] },
"ITEM" : { "cycled_billing_charge" : "cycled billing charge" },
"DO" : [
{ "drupal_message" : { "message" : "the period is [commerce-order:commerce-line-items:0:commerce-product:field-cycle-period-list]" } }
]
}
}
]
}
}
What's happening is it iterates through the proper amount of line items but it isn't incrementing; it is only messaging the first line item it sees.
I have looked at several articles and I have done some debugging. I'm at a very rudimentary level.