Configure a checkout flow with
- Login => Login or continue as guest
- Order information=> Contact information and nothing else
Start checkout as anonymous user. On the login page, choose to login. Error message is
Notice: Undefined index: order_information in Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->buildForm() (line 259 of XXX/modules/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php).
I guess that the problem is that commerce evaluated the next step based on the steps that were visible when logged out which includes order_information. However once logged in, that step is no longer visible. Maybe the problem is that CheckoutFlowWithPanesBase.php caches the value of visibleSteps and this cache is not cleared when the current user changes.
Comment | File | Size | Author |
---|---|---|---|
#10 | commerce_checkout.commerce_checkout_flow.default.yml | 772 bytes | AdamPS |
#7 | commerce-checkout_flow_steps-2981922-7-EXPECTED_FAIL.patch | 731 bytes | AaronBauman |
| |||
#4 | commerce.checkout_steps.2981922-4.patch | 2.75 KB | AdamPS |
| |||
#2 | commerce.checkout_steps.2981922-2.patch | 2.75 KB | AdamPS |
Comments
Comment #2
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedIt's a bit awkward to fix - after login, the existing login step is no longer visible, so getNextStepId doesn't work.
Comment #4
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedComment #5
bojanz CreditAttribution: bojanz at Centarro for Ny Media AS commentedWe need a failing test, the fix can come later.
Comment #6
AdamPS CreditAttribution: AdamPS at AlbanyWeb commented@bojanz thanks for taking a look at the issue. Setting status to "Needs work"/"Needs tests" as I don't have time to write a failing test right at this moment. If any one else is interested in this issue and willing to write a test please go ahead.
Comment #7
AaronBaumanI'm getting the same notice.
This patch isn't a test, but demonstrates the problem by adding an input check where the notice is being generated: if the given
$step_id
is not returned from::getVisibleSteps()
, then we shouldn't be trying to display it.This causes some existing tests to fail, demonstrating the error.
Comment #8
AaronBaumanOK i guess i'm eating crow - must be something specific to site configuration.
@AdamPS, can you apply patch #7 to see if this exception gets triggered?
Comment #9
AaronBaumanComment #10
AdamPS CreditAttribution: AdamPS at AlbanyWeb commented@aaronbauman Thanks for your help.
Yes it is specific to site configuration. The issue summary says "Configure a checkout flow with...". To generate a failing test would require making a test with that specific commerce flow.
I don't really know anything about writing tests for Commerce. However I have attached an export of my checkout flow. I know it seems odd putting payment_information in step "review", but this is a site that does not collect address information and we have overridden the class for payment_information using ys_commerce_checkout_pane_info_alter.
Comment #11
AdamPS CreditAttribution: AdamPS at AlbanyWeb commentedThe more recent issue #3044592: getVisibleSteps() can become stale is a duplicate of this and happily has just been fixed