- First commit to issue fork.
- ๐บ๐ธUnited States nicxvan
I think this is why a client of mine sometimes gets whitescreens in google tag from removed items and are unable to complete checkout.
I am going to update this to an MR and do some testing.
- Assigned to nicxvan
- Status changed to Needs work
8 months ago 6:25pm 18 April 2024 - Issue was unassigned.
- ๐บ๐ธUnited States nicxvan
I'm not sure why it's getting the permission issue now. I have to pause on this for now, the actual code seems to be working.
- ๐บ๐ธUnited States nicxvan
Ok now the failure is for the test that the checkout cart is the current cart.
So I think this means there is a bug in the code still.
- ๐บ๐ธUnited States nicxvan
Looking further, I think there might be a conflict when a user logs in during checkout flow.
What is happening is the order assignment event fires, and the hook user login fires, or vice versa.
One of those does a combine without a delete, the other does a combine with delete. I don't quite understand the distinction.
- ๐บ๐ธUnited States nicxvan
Note from Matt Glaman in slack:
The module should also track the requests its running on, so it doesnโt run 2x in one request like:
/** * Static cache of resolved stores. One per request. * * @var \SplObjectStorage */ protected $stores; $request = $this->requestStack->getCurrentRequest(); if (!$this->stores->contains($request)) { $this->stores[$request] = $this->chainResolver->resolve(); }
if the carts were determined for the request, donโt do anything
- Status changed to Needs review
8 months ago 3:33pm 3 May 2024 - ๐บ๐ธUnited States nicxvan
Not sure what is going wrong with the test. There was a long discussion in slack about being able to delete the cart when it's combined no matter what so I added that here.
The test should be doing the following: Log in as admin Add item to cart Store cart id for later comparison Log out Add item to cart as anonymous Store anonymous cart id for later comparison Go to checkout Log in as admin Confirm the current cart is the anonymous cart and it is combined.
This is how it works locally, but the comparison assert is failing.
Setting to needs review for advice. - ๐ฌ๐งUnited Kingdom steven jones
steven jones โ made their first commit to this issueโs fork.
- ๐ฌ๐งUnited Kingdom steven jones
@nicxvan So I fixed some bugs in in your test. However, you test is causing a fatal error on the test that's already in the module, and the test you're trying to add is still not working :(
The test only pipeline run: https://git.drupalcode.org/project/commerce_combine_carts/-/jobs/2912269 fails in a bit of a weird way:
Drupal\Core\Entity\EntityStorageException: Attempted to save order 2 with version 5. Current version is 6. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 817 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
Drupal\Core\Entity\EntityStorageBase->doPreSave(Object) (Line: 753)
Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object) (Line: 483)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 806)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 169)
Drupal\commerce_order\OrderStorage->save(Object) (Line: 354)
Drupal\Core\Entity\EntityBase->save() (Line: 463)
Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->submitForm(Array, Object) (Line: 614)
Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 129)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('commerce_checkout_flow_multistep_default', Array, Object) (Line: 326)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 224)
Drupal\Core\Form\FormBuilder->getForm(Object, 'login') (Line: 143)
Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 37)
Drupal\Core\Test\StackMiddleware\TestWaitTerminateMiddleware->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Do you reckon that's because combine carts has just combined this cart, and saved?
- ๐บ๐ธUnited States nicxvan
That's the root cause of an issue I've been trying to track down in commerce core!
๐ OrderVersionMismatchException when updating the cart or checking out Active is where I created an issue to track this and also ๐ Exception\OrderVersionMismatchException Closed: outdated .
- ๐บ๐ธUnited States nicxvan
Basically if you combine the carts in the wrong order you end up on the wrong revision.
I'll see if I can pull reproduction steps out for an issue on commerce core.