Currently the commerce_coupon_redemption_form element takes an order object when building the element. It stores it in the form state, which it should not. It should always load a fresh order from the element. This is because it can become out of sync when using AJAX operations for coupon redemption.

This is a blocker for implementing checkout integration and final pane.

Comments

mglaman created an issue. See original summary.

mglaman’s picture

Status: Active » Needs review
StatusFileSize
new2.58 KB
mglaman’s picture

Title: Coupon redemption should always load a fresh version of the order » Coupon redemption form needs severe improvements and bug fixes.
Status: Needs review » Needs work

There are errors all around the redemption form. Repurposing this ticket for general improvement items.

mglaman’s picture

mglaman’s picture

StatusFileSize
new13.21 KB

In current form, this element can be embedded and:

  • Ajax coupon submission works, allows going to next step
  • entering a coupon code and clicking "next" button ignores coupon, because it's attached do a now de-referenced order
mglaman’s picture

Status: Needs work » Needs review
StatusFileSize
new12.57 KB

Here is a patch which addresses all the things!

  • bojanz committed 3bcfdef on 8.x-2.x authored by mglaman
    Issue #2861002 by mglaman: Coupon redemption form needs severe...
bojanz’s picture

Status: Needs review » Fixed

And here's a commit which addresses all the things :)

  • bojanz committed 981f198 on 8.x-2.x
    Revert a piece of #2861002 that broke shipping.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.