Skip to content

Instantly share code, notes, and snippets.

@ipwa
Last active November 13, 2017 08:54
Show Gist options
  • Save ipwa/7c1dc0041c9a88d91a2279a337413327 to your computer and use it in GitHub Desktop.
Save ipwa/7c1dc0041c9a88d91a2279a337413327 to your computer and use it in GitHub Desktop.
Rule to make roomify booking charge for only one day of booking
{ "rules_chicama_pay_one_day" : {
"LABEL" : "Chicama pay one day",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_product_reference" ],
"ON" : { "commerce_product_calculate_sell_price" : [] },
"IF" : [
{ "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "commerce_product" } }
],
"DO" : [
{ "variable_add" : {
"USING" : { "type" : "decimal", "value" : "0" },
"PROVIDE" : { "variable_added" : { "oneday_price" : "One day price for this line item" } }
}
},
{ "variable_add" : {
"USING" : { "type" : "decimal", "value" : "0" },
"PROVIDE" : { "variable_added" : { "booking_days" : "Days" } }
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment