Class Ecommerce.Cart.AfterOrderValidationArgs
- Namespace
- Dynamicweb.Ecommerce.Notifications
- Assembly
- Dynamicweb.Ecommerce.dll
Provides information after order validation is executed.
public class Ecommerce.Cart.AfterOrderValidationArgs : NotificationArgs
- Inheritance
-
Ecommerce.Cart.AfterOrderValidationArgs
- Inherited Members
Examples
namespace Dynamicweb.Ecommerce.Examples.Notifications.CartV2
{
[Dynamicweb.Extensibility.Notifications.Subscribe(Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterOrderValidation)]
public class EcomCartAfterOrderValidationObserver : Dynamicweb.Extensibility.Notifications.NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.Notifications.NotificationArgs args)
{
var afterValidationArgs = args as Dynamicweb.Ecommerce.Notifications.Ecommerce.Cart.AfterOrderValidationArgs;
// Add custom validation error
var validationError = new Dynamicweb.Ecommerce.Orders.Validation.ValidationError();
validationError.ValidationField = Dynamicweb.Ecommerce.Orders.Validation.ValidationField.GetFieldBySystemName("EcomOrderDeliveryCountry");
validationError.ErrorMessage = "Error message from notification subscriber";
afterValidationArgs.ValidationErrors.Add(validationError);
}
}
}
Properties
Order
The Order being validated.
public Order Order { get; set; }
Property Value
- Order
- The order.
ValidationErrors
A list of validation errors.
Add or remove errors from the collection to modify the result of the validation.
public IList<ValidationError> ValidationErrors { get; set; }
Property Value
- IList<ValidationError>
- A list of validation errors.