I guess this is a cross between a bug and feature request. After adding a coupon, it will only refresh the cart view attached to a pane. This means that if the coupon entry is moved to say the review pane, once added and rules or modules reacting to the price (No Payment comes to mind) do not fire/act because the ajax request targets the line item view specifically.

The coupon module would increase its friendliness by increasing the scope of its refresh to the entire page, or at least offer some sort of Rule plugin to support things that are in direct reliance on the price.

#10 1916600-commerce_coupon-refresh_payment.patch898 bytestorgosPizza
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es). View


pcambra’s picture

Category:bug» feature

Review pane is out of scope, the "natural" place for placing coupons is the "checkout" step, review should be "read only".

In any case, patches are welcome if there's interest about the feature.

drupalninja99’s picture

Version:7.x-1.x-dev» 7.x-1.0-beta7

I have an issue where the order total is not updated when rules checks the order balance on the review page. Here is the workflow:

1. Add coupon to checkout page (without the 'add coupon' button), click continue
2. When rules checks the order total on the review page it does not see the new adjusted amount
3. Click back, then continue
4. Now rules sees the correct order total

If I use the ajax 'add coupon' button the order total is correct on the review page. This is a bug bc the review page should have the updated total no matter what method the coupon was added. This is a problem for rules that check the balance to see if the credit card fields should be displayed.

Does that make sense?

pcambra’s picture

Version:7.x-1.0-beta7» 7.x-1.x-dev

Are you adding the coupon in the review page? otherwise it's a completely unrelated problem.

drupalninja99’s picture

Sorry, no I am adding to the checkout page

pcambra’s picture

Then please don't comment on unrelated issues and open a new one with your support request.

amberau79’s picture

I would also like to see the ajax refresh scope increased. I want to show the zero total payment method when a coupon covers the entire order amount but I'm stumped for a good method of doing this when a single button only allows a single ajax callback. Would be happy to hear any suggested solutions to this problem. I imagine there are other cases where this would be useful as well.

It seems to me that the primary issue here "Coupon Addition only refreshes cart view" applies equally wherever the coupon is being added. The ajax scope is still too limited.

brogdawg’s picture

Issue summary:View changes

I am also looking for a solution to this. Like amberau79 I will sometimes have coupons for 100% off which makes the total $0. I have conditions for my payment methods to only have CC payment available when total is greater than $0 and a 'No payment required' method to available when total is less than or equal to $0. I have my coupon and payment method all on the checkout page and do not have a review order page.

With that said, if I add a coupon on my checkout page for 100% off I am still shown the credit card payment method even though the total is $0. If I refresh the page then only the 'No payment required' method is available as desired. However, if I remove the coupon then the entire page refreshes and I get the appropriate payment method again. Is there no way to have the entire checkout page refresh when a coupon is added like it does when a coupon is removed. I believe this would also solve this issue https://drupal.org/node/2157177

Gomez_in_the_South’s picture

Add my name to the list of people that could use this.

In my case, we offer free shipping for orders above $80. If a user initially orders $85, he is given free shipping. If he then applies a coupon to reduce the total below the $80 threshold, the free shipping still erroneously applies. A page refresh will apply the correct calculation.

torgosPizza’s picture

We also have a need for this. As an example, I'm toying with the notion of moving the Payment pane to the Checkout page, so users can select PayPal and not be required to enter any billing info. If a user enters a 100% off Coupon, the "Coupon Usage" pane refreshes but not the payment pane, resulting in them still having a Payment Method selection form. They then need to refresh the page for the desired result.

I'll look into this and see if there is any way to easily reload any panes on the current page, outside of refreshing the entire page.

#1329600: Provide ajax support to reload form after coupon has been added
#1329308: Provide better core support for AJAX reloading of checkout panes / pages (for Commerce)

torgosPizza’s picture

Version:7.x-1.x-dev» 7.x-2.x-dev
Status:Active» Needs review
898 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es). View

Here's a small patch for 2.x that refreshes the payment pane if it exists in the $form.

I think it makes sense to do this at the Commerce Coupon level since it is possible to add a coupon that covers 100% of the order.

torgosPizza’s picture

Issue tags:+commerce-sprint

Very small patch and IMO a necessary addition for correctly handling free orders with coupons (and one-page checkout configs).