Advertisement
MrJoshMiller

Create a node on checkout for each line item part 1 of 2

Jun 20th, 2013
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.01 KB | None | 0 0
  1. { "rules_create_a_node_for_each_line_item" : {
  2.     "LABEL" : "Create a node for each line item",
  3.     "PLUGIN" : "reaction rule",
  4.     "REQUIRES" : [ "rules", "commerce_payment" ],
  5.     "ON" : [ "commerce_payment_order_paid_in_full" ],
  6.     "DO" : [
  7.       { "entity_query" : {
  8.           "USING" : {
  9.             "type" : "commerce_line_item",
  10.             "property" : "order_id",
  11.             "value" : [ "commerce-order:order-id" ],
  12.             "limit" : "1000"
  13.           },
  14.           "PROVIDE" : { "entity_fetched" : { "line_items" : "All line items" } }
  15.         }
  16.       },
  17.       { "LOOP" : {
  18.           "USING" : { "list" : [ "line-items" ] },
  19.           "ITEM" : { "line_item" : "Current line item" },
  20.           "DO" : [
  21.             { "component_rules_create_a_node_for_each_line_item_component" : {
  22.                 "USING" : { "line_item" : [ "line-item" ] },
  23.                 "PROVIDE" : { "line_item" : { "line_item0" : "line_item" } }
  24.               }
  25.             }
  26.           ]
  27.         }
  28.       }
  29.     ]
  30.   }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement