Skip to content

Instantly share code, notes, and snippets.

@andyg5000
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyg5000/9071841 to your computer and use it in GitHub Desktop.
Save andyg5000/9071841 to your computer and use it in GitHub Desktop.
Makes sure that an orders shipping address exists and has US as it's country.
{ "rules_order_has_domestic_shipping" : {
"LABEL" : "Order has domestic shipping",
"PLUGIN" : "and",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_order" ],
"USES VARIABLES" : { "commerce_order" : { "label" : "Commerce Order", "type" : "commerce_order" } },
"AND" : [
{ "entity_has_field" : {
"entity" : [ "commerce-order" ],
"field" : "commerce_customer_shipping"
}
},
{ "NOT data_is_empty" : { "data" : [ "commerce-order:commerce-customer-shipping" ] } },
{ "commerce_order_compare_address" : {
"commerce_order" : [ "commerce_order" ],
"address_field" : "commerce_customer_shipping|commerce_customer_address",
"address_component" : "country",
"value" : "US"
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment