Skip to content

OrderValidatorsTrait ​

Type
Trait
Namespace
craft\commerce\elements\traits
Implemented by
craft\commerce\elements\Order

OrderValidatorsTrait implements the methods used in Order validation.

View source

Public Methods ​

MethodDescription
validateAddress()Validates addresses, and also adds prefixed validation errors to order
validateAddressCountry()Validates that address country is in the allowed list.
validateAddressReuse()Validates that shipping address isn't being set to be the same as billing address, when billing address is set to be shipping address
validateCouponCode()
validateGatewayId()
validateLineItems()Validates line items, and also adds prefixed validation errors to order
validateOrganizationTaxIdAsVatId()
validatePaymentCurrency()
validatePaymentSourceId()

validateAddress() ​

Validates addresses, and also adds prefixed validation errors to order

View source

Arguments ​

  • $attribute (string) – The attribute being validated

Throws ​

validateAddressCountry() ​

Validates that address country is in the allowed list.

View source

Arguments ​

  • $attribute (string) – The attribute being validated

validateAddressReuse() ​

Validates that shipping address isn't being set to be the same as billing address, when billing address is set to be shipping address

View source

Arguments ​

  • $attribute (string) – The attribute being validated

validateCouponCode() ​

View source

Arguments ​

  • $attribute (mixed)

Throws ​

validateGatewayId() ​

View source

Arguments ​

validateLineItems() ​

Validates line items, and also adds prefixed validation errors to order

View source

validateOrganizationTaxIdAsVatId() ​

Since
5.0.0

View source

Arguments ​

  • $attribute (mixed)

Returns ​

void

Throws ​

validatePaymentCurrency() ​

View source

Arguments ​

validatePaymentSourceId() ​

View source

Arguments ​