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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AdamPS created an issue. See original summary.

AdamPS’s picture

Status: Active » Needs review
FileSize
2.75 KB

It's a bit awkward to fix - after login, the existing login step is no longer visible, so getNextStepId doesn't work.

Status: Needs review » Needs work

The last submitted patch, 2: commerce.checkout_steps.2981922-2.patch, failed testing. View results

AdamPS’s picture

Status: Needs work » Needs review
FileSize
2.75 KB
bojanz’s picture

We need a failing test, the fix can come later.

AdamPS’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

@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.

AaronBauman’s picture

Status: Needs work » Needs review
FileSize
731 bytes

I'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.

AaronBauman’s picture

OK 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?

AaronBauman’s picture

Status: Needs review » Needs work
AdamPS’s picture

@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.

AdamPS’s picture

Status: Needs work » Closed (duplicate)
Issue tags: -Needs tests
Related issues: +#3044592: getVisibleSteps() can become stale

The more recent issue #3044592: getVisibleSteps() can become stale is a duplicate of this and happily has just been fixed