Skip to content

Instantly share code, notes, and snippets.

@Pythagory
Created September 23, 2014 17:55
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 Pythagory/f46da35a057a85a1268a to your computer and use it in GitHub Desktop.
Save Pythagory/f46da35a057a85a1268a to your computer and use it in GitHub Desktop.
Drupal Commerce: Price Product Based on Product Type
{ "rules_price_square_widgets" : {
"LABEL" : "Set price of square widgets",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
"ON" : { "commerce_product_calculate_sell_price" : [] },
"IF" : [
{ "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" : "commerce_product" } },
{ "data_is" : {
"data" : [ "commerce-line-item:commerce-product:type" ],
"value" : "square_widgets"
}
}
],
"DO" : [
{ "commerce_line_item_unit_price_amount" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : "1000",
"component_name" : "base_price",
"round_mode" : "1"
}
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment