Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckoutController does not add errors provided by InvalidCartException but only from the original cart. #2549

Open
AndreasA opened this issue Jun 21, 2022 · 0 comments
Labels

Comments

@AndreasA
Copy link
Contributor

PHP Version

8.1

Shopware Version

6.4.12.0

Expected behaviour

Show errors provided in InvalidCartException at https://github.com/shopware/platform/blob/v6.4.12.0/src/Storefront/Controller/CheckoutController.php#L220 instead of the errors from the original cart.

This can e.g. by an issue if the re-calculation adds new errors, e.g. due to adding a state in the order route or due to time changes etc.

Probably similar issue with the other exceptions.

Solutions:

  • Create an empty cart with the provided error or error collection - depending on the exception type and add those errors.
  • Create a separate method that does what addCartErrors does but one can provide the cart error collection and the addCarterrors calls that one with the corresponding error colleciton.
  • Add the cart to the `InvalidCartException and use that cart to add the cart errors. However, that will not take the other exceptions into account.

Actual behaviour

Errors provided through InvalidCartException are ignored and the original cart errors are used.

How to reproduce

Fail safe method to reproduce:

  • Decorate: CartOrderRoute.
  • Add a state in decoarted CartOrderRoute.
  • Add a cart validator.
  • Add an error to the cart if the state added in CartOrderRoute exists.
  • The error will not be shown in the frontend, as the original cart did not have that error before re-calculation in the cart order route.
@AndreasA AndreasA added the Bug label Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant