Advertisement
MrJoshMiller

Add a default organization on Order Completion if none exist

Mar 14th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. { "rules_default_organization" : {
  2.     "LABEL" : "Add a default organization on Order Completion if none exists",
  3.     "PLUGIN" : "reaction rule",
  4.     "REQUIRES" : [ "rules", "entity" ],
  5.     "ON" : [ "commerce_order_update" ],
  6.     "IF" : [
  7.       { "data_is" : { "data" : [ "commerce-order:status" ], "value" : "checkout_complete" } },
  8.       { "entity_has_field" : { "entity" : [ "commerce-order" ], "field" : "commerce_customer_billing" } },
  9.       { "entity_has_field" : {
  10.           "entity" : [ "commerce-order:commerce-customer-billing" ],
  11.           "field" : "commerce_customer_address"
  12.         }
  13.       },
  14.       { "data_is_empty" : { "data" : [
  15.             "commerce-order:commerce-customer-billing:commerce-customer-address:organisation-name"
  16.           ]
  17.         }
  18.       }
  19.     ],
  20.     "DO" : [
  21.       { "data_set" : {
  22.           "data" : [
  23.             "commerce-order:commerce-customer-billing:commerce-customer-address:organisation-name"
  24.           ],
  25.           "value" : "Google, Inc."
  26.         }
  27.       },
  28.       { "entity_save" : { "data" : [ "commerce-order" ] } }
  29.     ]
  30.   }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement