Created
November 9, 2013 20:02
-
-
Save mglaman/7389311 to your computer and use it in GitHub Desktop.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { "rules_alter_line_item_label" : { | |
| "LABEL" : "Alter line item label", | |
| "PLUGIN" : "reaction rule", | |
| "OWNER" : "rules", | |
| "REQUIRES" : [ "rules", "commerce_cart" ], | |
| "ON" : { "commerce_cart_product_add" : [] }, | |
| "IF" : [ | |
| { "entity_is_of_type" : { "entity" : [ "commerce-line-item" ], "type" : "commerce_line_item" } }, | |
| { "data_is" : { "data" : [ "commerce-product:type" ], "value" : "product" } } | |
| ], | |
| "DO" : [ | |
| { "data_set" : { | |
| "data" : [ "commerce-line-item:line-item-label" ], | |
| "value" : "[commerce-product:type]-[commerce-order:uid]" | |
| } | |
| } | |
| ] | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment