Skip to content

Instantly share code, notes, and snippets.

@mglaman
Created September 10, 2013 17:07
Show Gist options
  • Save mglaman/6512450 to your computer and use it in GitHub Desktop.
Save mglaman/6512450 to your computer and use it in GitHub Desktop.
If you're using Flat Rate shipping on Drupal Commerce, this update rule will prevent calculation of the customer shipping profile is empty.
{ "commerce_shipping_method_flat_rate" : {
"LABEL" : "Collect rates: Flat rate",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "commerce_shipping" ],
"ON" : [ "commerce_shipping_collect_rates" ],
"IF" : [
{ "entity_has_field" : {
"entity" : [ "commerce-order" ],
"field" : "commerce_customer_shipping"
}
},
{ "NOT data_is_empty" : { "data" : [ "commerce-order:commerce-customer-shipping" ] } }
],
"DO" : [
{ "commerce_shipping_method_collect_rates" : {
"shipping_method_name" : "flat_rate",
"commerce_order" : [ "commerce-order" ]
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment