I made a small module that adds a checkbox to accept the terms and conditions in the purchase tunnel.
Why when I uninstall a module that creates a "Checkout Pane" it removes all "Checkout Flows" ?
Every module that adds "Checkout Pane" has the same problem. This problem is very annoying.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | Capture d’écran du 2021-05-20 09-52-06.png | 68.66 KB | zenimagine |
| #16 | 3200217-16.patch | 6.12 KB | jsacksick |
Comments
Comment #2
jsacksick commentedProbably because of this code:
present in CheckoutFlowWithPanesBase::calculateDependencies().
That adds dependencies on all the checkout panes.
Comment #3
bojanz commentedThis feels like a bug.
Comment #4
zenimagine commentedDo you have a temporary solution, so that I can uninstall my module without breaking my Drupal Commerce configuration ?
Comment #5
jsacksick commentedTry commenting the code in calculateDependencies()? (that is
CheckoutFlowWithPanesBase::calculateDependencies()and see if this makes a difference.Comment #6
zenimagine commented@jsacksick I use Composer to manage modules and dependencies. Do you have a patch to do this? Thank you
Comment #7
zenimagine commented@bojanz @jsacksick Hi, who can patch please? I have been stuck for months with this issue. I can test a fix.
Comment #8
jsacksick commentedI managed to write a failing test, but I've failed to fix the issue itself for now.
I started adding the following to CheckoutFlow:
But that doesn't seem to do the trick as when
calculateDepencies()is then called, the dependency is re-added.Comment #9
zenimagine commented@jsacksick Thanks for your answer, I started to despair. I have been totally stuck with this problem for months, cannot uninstall the "Commerce Agree Terms" module, it erases all Checkout flows.
Should I test your patch or wait for the next one ?
Comment #10
jsacksick commented@zenimagine: No, not yet, the test i wrote demonstrates the problem, but haven't managed to fix it yet.
Comment #12
jsacksick commentedThe attached patch should do the trick, hopefully!
Comment #13
jsacksick commentedComment #14
zenimagine commented@jsacksick Ok thank you, I will test the last path tonight.
Comment #15
zenimagine commented@jsacksick I just tested the patch, when I uninstall my module, all checkout flows are deleted except "default". Custom checkout flows should not be deleted.
Comment #16
jsacksick commentedI didn't upload the right patch in #13, but the changes done since aren't altering the logic. I wrote a functional test proving the logic works, and just to be sure, I just retested this myself manually.
The test configures a pane from a module that is then uninstalled, the test confirms the checkout flow still exists after uninstalling the module, and the configuration is correctly updated (i.e the pane that was provided by the module is removed from the checkout flow configuration).
Comment #17
zenimagine commented@jsacksick I am not familiar with programming. I tested the last patch and it is identical to my previous comment. If I uninstall my custom module, all checkout Flows is deleted except the Default checkout Flows.
Comment #18
jsacksick commentedhm... I'm really not sure what to do then, the test I wrote is testing exactly that, and I manually tested this as well, and the checkout flow remained.
Are the checkout flows provided by the module you're uninstalling as well?
Comment #19
zenimagine commented@jsacksick Have you created other Cash Flow? My module simply add a checkbox in the purchase funnel to accept the terms and conditions.
I have 4 cash flows and only the default flow is not erased.
https://git.drupalcode.org/sandbox/zenimagine-3082137
Comment #20
jsacksick commentedYes, I tested with other checkout flows, tried it again just now.
I created a custom checkout flow, saved it with the custom checkout pane, then uninstalled the module providing the checkout pane, and the checkout flow remained.
Comment #21
zenimagine commented@jsacksick I do not understand why on my site it is erasing Custom Checkout Feeds. Can you test with my module ?
Comment #23
jsacksick commentedI went ahead and committed a fix since I was able to reproduce the bug manually and wrote a failing test that no longer fails with the fix.