Error in user YAML: (<unknown>): found character that cannot start any token while scanning for the next token at line 5 column 16
---
title: Add blockResubmit functionality to cart validators
issue: NEXT-25555
author: Altay Akkus
author_email: [email protected]
author_github: @AltayAkkus
---
- Added feature
blockResubmit
for cart validators, which should block the order, but not prevent the user from retrying. - Added Twig checks for
blockResubmit
insrc/Storefront/Resources/views/storefront/page/checkout/confirm/index.html.twig
. - Added
blockResubmit
method tosrc/Core/Checkout/Cart/Error/Error.php
. - Added
blockResubmit
error collection insrc/Core/Checkout/Cart/Error/ErrorCollection.php
. - Added
blockResubmit
to the errors facade insrc/Core/Checkout/Cart/Facade/ErrorsFacade.php
via the methodresubmittable()
. - Added
blockResubmit
andblockOrder
parameters to the TestError class intests/unit/php/Core/Checkout/Cart/Order/TestError.php
. - Added
blockResubmit
check totestErrorTypes
and createdtestErrorResubmittable
intests/unit/php/Core/Checkout/Cart/Order/ErrorCollectionTest.php
.
blockResubmit
allows developers to create cart errors that do not block the user from trying to submit their cart again.
This can be useful if the error can be automatically corrected (like PaymentMethodChangedError
), or does not require user intervention but user approval (like ProductOutOfStockError
).
You can add it to your error by overriding the default blockResubmit(): bool
method from Shopware\Core\Checkout\Cart\Error\Error
, true
blocks the resubmit button, false
does not.
If a cart has multiple errors, a single blockResubmit = true
overrides all other errors, just like blockOrder
.