Hi,

I'm using all the latest -dev versions of the coupon modules etc.. including the update that removed the coupon log entity.

When I add a percentage coupon during checkout and progress to the payment step, the percentage coupon doesn't show up in the order / line item summary.

If I click 'back' and then forward to payment again, the coupon then shows up.

I tried a manual 'commerce_cart_order_refresh' after checkout form submit, and that causes the coupon to show up.
However, that method also causes problems linking the customer profiles to the anon order :(
Also, commerce_cart_order_refresh should happen automatically during cart state order checkout.

Is there any way to get the percentage coupon showing up straight away on first pass through checkout?

thanks,

DT

Comments

pcambra’s picture

Status: Active » Postponed (maintainer needs more info)

I can't reproduce this, could you enable the rules log setting and see why the rule related to the coupon is not being applied, that rule is called "Apply percentage coupons to product line item" and if that rule doesn't return true for the conditions, the coupon is automatically discarded.
There's no hook_line_item_refresh or hook_order_refresh anymore.

Maybe it's related with the payment? are you using a specific gateway? does this happen with the example payment module?

davidwhthomas’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Thanks pcambra,

It might be something to do with the nature of my project, but there was an issue applying percent coupons during checkout.

I've gone ahead and created a variation of the commerce_coupon_pct that actually adds a line item to the order, instead of adjusting the price of the other line items.

The code just loops over the product line items and builds the total discount amount as a percent of each product.
The project only ever has 1 product in the cart, so it's a bit easier.
It then adds a line item, similar to fixed amount coupon with that amount.

This new one is working normally, as expected, so I guess can close this issue.

kpojeta’s picture

Status: Closed (cannot reproduce) » Active

I figured I would keep the same issue on the same issue ticket.... While the original poster had a workaround for their use-case, I also cannot get a percentage applied. When I review the logs I see this:

Unable to get a data value. Error: Invalid data value given. Be sure it matches the required data type and format.
and
Unable to evaluate condition data_is. --I get the option here to edit the configuration which takes me to the Rule for either percentage or fixed amount, both which appear to be correct.

jbova’s picture

I am having the same issue as kpojeta.

esha’s picture

Issue summary: View changes

please note:

on /admin/commerce/config/order, there's also a checkbox labelled
"Always refresh shopping cart orders on shopping cart and checkout form pages regardless of other settings."

If this box is not checked, the coupon only seems to be redeemed after the default "Shopping cart refresh frequency"...

Checking it solved the OC problem in my case