Closed (fixed)
Project:
Commerce Coupon (D7)
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2013 at 01:38 UTC
Updated:
17 Feb 2013 at 06:20 UTC
I want something like: Buy two, and get $5 off your second item.
I've created this rule:
{ "rules_comm" : {
"LABEL" : "Bulk discount (2)",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "commerce_coupon", "commerce_cart" ],
"ON" : [ "commerce_cart_product_add", "commerce_cart_product_remove" ],
"DO" : [
{ "commerce_coupon_action_create_coupon_line_item" : {
"USING" : {
"commerce_coupon" : "76",
"commerce_order" : [ "commerce_order" ],
"amount" : "500",
"component_name" : "base_price",
"currency_code" : [ "commerce-order:commerce-order-total:currency-code" ]
},
"PROVIDE" : { "commerce_coupon_line_item" : { "commerce_coupon_line_item" : "commerce coupon line item" } }
}
}
]
}
}
But it does nothing to the order that I can see. How does one add a coupon to an order?
Comments
Comment #1
pcambraI've made a quick and dirty test.
You'd pobably want to play around this one but the export below is a rule that adds a coupon to the current user's cart on content view
Comment #2
aidanlis commentedGreat! Thanks so much for providing that, I'm sure it'll come in handy for other developers also.