Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently the order will be placed until it reaches complete step on checkout, how to freeze the order on payment step?
For example PayPal Express Checkout (offsite), after the page is redirected to PayPal the order should be frozen (not a 'cart' order any more) to avoid updating the order, e.g. add a product to cart or update quantity of an item in cart.
Comment | File | Size | Author |
---|---|---|---|
#11 | 2906563-11.patch | 18.7 KB | bojanz |
Comments
Comment #2
edaa CreditAttribution: edaa commentedComment #3
edaa CreditAttribution: edaa commentedPR https://github.com/drupalcommerce/commerce/pull/785 created.
Any thoughts on this case?
Comment #4
edaa CreditAttribution: edaa commentedComment #5
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedWhat if payment fails? Can you still choose an other payment method in that case?
Comment #6
edaa CreditAttribution: edaa commentedYou are right, I can't. Need to find another way to freeze the order.
Comment #7
edaa CreditAttribution: edaa commentedMaybe just invoke finalizeCart on payment step, the order is still 'draft' and 'order refresh' will run on it.
Comment #8
edaa CreditAttribution: edaa commentedComment #9
bojanz CreditAttribution: bojanz at Centarro commentedWe planned this, but never implemented it.
We need a "locked" boolean on the order, and we need lock() / unlock() / isLocked() methods on OrderInterface.
We need CartProvider to filter out locked orders after they're loaded.
We need PaymentProcess to lock the order before rendering the offsite-form, and we need to make sure placing an order unlocks it.
We also need to figure out the admin UX for locked orders. My current idea is to return access denied, causing the edit tab to not be available, and have an unlock form for breaking the lock.
Comment #10
bojanz CreditAttribution: bojanz at Centarro commentedWrapping this up.
Comment #11
bojanz CreditAttribution: bojanz at Centarro commentedCurrent progress. There's a single test fail, OrderUserTest, which I haven't tracked down yet.
Comment #13
bojanz CreditAttribution: bojanz at Centarro commentedFixed the bug that was failing the test, and made sure that clicking "Go back" in the checkout payment page (iframe gateways) unlocks the order.
Still feels like we need more test coverage, but what we added here is a good start.
Comment #14
edaa CreditAttribution: edaa commentedWow, thanks, it works pretty well.