Place items in cart: Total $21.65
Applying a 20% off coupon.
Transaction Details:
Subtotal $21.65
Coupon -$21.65
State of Illinois 6.25% Rate $1.35
Shipping $20.28
Order total $21.63
As you can see, coupon is providing a 100% off.
I apply new items to the cart:
Subtotal $53.40
Coupon -$21.65
State of Illinois 6.25% Rate $3.34
Order total $35.09
20% coupon keeps the original, albeit wrong, amount.
I was fighting with the production version of this module and the percentage being applied to the entire (shipping, et al) and brought in this dev version today.
I would like to help with this module but I don't want to step on someone else's toes if they are working on this issue.
If not, where could I focus my attention to resolve this? Rules?
Thank you,
Comments
Comment #1
pcambraI strongly recommend to use the -dev version plus commerce coupon percentage module. Then you should be able to reorder the rules to decide which one comes first.
Comment #2
michalsen commentedI have it working with the following rule using a db_query() to grab the appropriate data:
Currently working through Coupons tied to specific SKU's.
{ "rules_calculate_coupon_with_percentage_amount" : {
"LABEL" : "Calculate coupon with percentage amount",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "php", "commerce_coupon" ],
"ON" : [ "commerce_coupon_redeem" ],
"IF" : [
{ "entity_has_field" : { "entity" : [ "coupon" ], "field" : "commerce_coupon_percent_amount" } },
{ "NOT AND" : [
{ "data_is_empty" : { "data" : [ "coupon:commerce-coupon-percent-amount" ] } }
]
},
{ "data_is" : {
"data" : [ "coupon:commerce-coupon-percent-amount" ],
"op" : "\u003E",
"value" : "0"
}
}
],
"DO" : [
{ "commerce_coupon_action_create_coupon_line_item" : {
"USING" : {
"commerce_coupon" : [ "coupon" ],
"commerce_order" : [ "commerce_order" ],
"amount" : {
"select" : "commerce-order:commerce-order-total:amount",
"php" : { "code" : "$rsts = db_query(\u0027SELECT commerce_coupon_percent_amount_value FROM field_data_commerce_coupon_percent_amount WHERE entity_id = :entity_id\u0027, array(\u0027:entity_id\u0027 =\u003E 9));\r\nforeach($rsts as $rst){\r\n $discount = $rst-\u003Ecommerce_coupon_percent_amount_value;\r\n} \r\nreturn $value * $discount;" }
},
"currency_code" : [ "commerce-order:commerce-order-total:currency-code" ]
},
"PROVIDE" : { "commerce_coupon_line_item" : { "commerce_percentage_coupon_line_item" : "commerce percentage coupon line item" } }
}
},
{ "commerce_coupon_action_set_granted_amount" : {
"commerce_coupon_log" : [ "coupon-log" ],
"amount" : [ "coupon:commerce-coupon-percent-amount" ],
"currency_code" : [ "commerce-order:commerce-order-total:currency-code" ]
}
}
]
}
}
Comment #3
pcambraDefinitely not an answer to my comments on #1, have you tried -dev version with the pct module?
Comment #4
michalsen commentedWhat happens when someone changes a quantity amount of a product after reviewing the checkout cart, prior to purchasing?
Comment #5
pcambraThat's a really different question, isn't it? have you tried it?
Comment #6
michalsen commentedbeen trying it...previous to this dev I was working on a rule to delete the coupon, which is really just a cheap hack as the user has already put in the coupon and if they change an amount they will then be forced to renter the coupon, which could cause issues with the log count.