Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Background: I'm building a free shipping coupon type. I added a flat rate shipping which have a "component" with the rule to apply this service. I'm looping over all order coupons to see if there is a coupon type == free_shipping for make the service available if true. The problem is that the rules always give me coupon type = 'percentage'. This is the rule export
{ "commerce_shipping_service_ups_ground_free_shipping_coupon" : {
"LABEL" : "Rate UPS - GROUND - Free Shipping Coupon",
"PLUGIN" : "rule",
"REQUIRES" : [ "rules" ],
"USES VARIABLES" : { "commerce_order" : { "type" : "commerce_order", "label" : "Order" } },
"IF" : [
{ "entity_has_field" : {
"entity" : [ "commerce-order" ],
"field" : "commerce_coupon_order_reference"
}
}
],
"DO" : [
{ "LOOP" : {
"USING" : { "list" : [ "commerce-order:commerce-coupon-order-reference" ] },
"ITEM" : { "coupon_applied" : "Coupon applied" },
"DO" : [
{ "component_rules_enable_free_shipping_if_coupon_applied" : {
"commerce_coupon" : [ "coupon-applied" ],
"commerce_order" : [ "commerce-order" ]
}
}
]
}
},
{ "drupal_message" : { "message" : [ "commerce-order:commerce-coupon-order-reference:0:type:label" ] } }
]
}
}
I also tried to use php evaluation. All the coupon data is correct EXCEPT coupon type.
Any help is welcome.