Alter Commerce Line Item label after added to order.

Public

Example rule for altering a line item's label when adding a product to the cart. When a product is added to the cart a line item is created for that order, with its title being the product's SKU. This allows altering of the SKU when added to the order.

</> CopyGet raw version
text
  1. { "rules_alter_line_item_label" : {
  2. "LABEL" : "Alter line item label",
  3. "PLUGIN" : "reaction rule",
  4. "OWNER" : "rules",
  5. "REQUIRES" : [ "rules", "commerce_cart" ],
  6. "ON" : { "commerce_cart_product_add" : [] },
  7. "IF" : [
  8. { "entity_is_of_type" : { "entity" : [ "commerce-line-item" ], "type" : "commerce_line_item" } },
  9. { "data_is" : { "data" : [ "commerce-product:type" ], "value" : "product" } }
  10. ],
  11. "DO" : [
  12. { "data_set" : {
  13. "data" : [ "commerce-line-item:line-item-label" ],
  14. "value" : "[commerce-product:type]-[commerce-order:uid]"
  15. }
  16. }
  17. ]
  18. }
  19. }