You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
The onCheckoutProcessing event handler in the checkout context will get used by validation routines or processes that can abort the checkout being processed.
For reference, see the flow as outlined here:
This means:
eventEmitter must handle aborting running any subsequent subscribed observers as soon as an observer returns an error object (anything but true).
onCheckoutProcessing will handle error objects that are returned from aborted events and update relevant checkout statuses and error states.
Suggested apis (roughly):
This has the overall idea, but there are still some specifics that likely will need worked out as a part of the implementation.
A subscriber triggering a processing abort would be expected to return an error object in the following shape:
consterror={message: 'Main error message',validation: {propertyFailingValidation: 'error message for field',anotherPropertyFailingValidation: 'error message for field',}};
The message property will be output in an error notice by the checkout context.
The validation property is for errors triggered by validation fails. The value is an object where properties correspond to field properties/ids for existing form fields and values correspond to the validation error message to accompany the field error.
Implementation wise, the errors can be exposed on the checkout context and field components can grab that (via context hook) to determine whether there is an error and whether there are any matching validation properties for the field the component outputs.
Additional considerations
I don't anticipate there would be a lot of subscribers hooked into the onCheckoutProcessing hook, but I do wonder if instead of aborting after a single subscriber fail, if we should accumulate all the error objects and aggregate them? That might be a better customer experience for fixing all the potential issues rather than fixing for one subscriber and then getting hit by the next subscriber after?
The text was updated successfully, but these errors were encountered:
As noted by Nadir, there's an alignment issue with the invalid coupon message in the context of the checkout.
CSS and alignment of validation messages could be improved (in context of checkout). Layout will break if the error message is longer and breaks into two lines.
The
onCheckoutProcessing
event handler in the checkout context will get used by validation routines or processes that can abort the checkout being processed.For reference, see the flow as outlined here:
This means:
true
).onCheckoutProcessing
will handle error objects that are returned from aborted events and update relevant checkout statuses and error states.Suggested apis (roughly):
This has the overall idea, but there are still some specifics that likely will need worked out as a part of the implementation.
A subscriber triggering a processing abort would be expected to return an error object in the following shape:
The
message
property will be output in an error notice by the checkout context.The
validation
property is for errors triggered by validation fails. The value is an object where properties correspond to field properties/ids for existing form fields and values correspond to the validation error message to accompany the field error.Implementation wise, the errors can be exposed on the checkout context and field components can grab that (via context hook) to determine whether there is an error and whether there are any matching validation properties for the field the component outputs.
Additional considerations
onCheckoutProcessing
hook, but I do wonder if instead of aborting after a single subscriber fail, if we should accumulate all the error objects and aggregate them? That might be a better customer experience for fixing all the potential issues rather than fixing for one subscriber and then getting hit by the next subscriber after?The text was updated successfully, but these errors were encountered: