-
Loki Checkout
- User documentation
-
Developer documentation
- Modules
- Getting started
- Architecture
-
Basic customizations
- Customizing component appearance
- Simple XML layout changes for fields
- Customer Address configurations
- Customizing CSS classes
- Changing the grid of field blocks
- Child block rendering
- Field validation and filtering
- Styling input fields
- Adding a custom block to a form
- Ordering blocks properly
- Changing error messages
- Changing the date field format
- Customizing the progress bar
- Using ImageOutput ViewModel
- Changing the cart item quantity
- Advanced customizations
- Integrations
- Troubleshooting
- ADR
- Playbook
- Reference
- Milestones and roadmap
- Module overview
- Frequently Asked Questions
- Loki Components
- Loki Field Components
- Loki Admin Components
- Loki Theme Kit
- Loki Base
- Miscellaneous
Field validation and filtering
By default, every field is a Loki Component with a ViewModel (ComponentViewModel) and a repository (ComponentRepository). If the ViewModel class is extending from \Yireo\@todo\AddressFieldViewModel, you automatically get a basic validation for that field: If the field is required but the value is empty, then an error is added to the component - simple.
Validating a field value
On top of this, each AddressFieldComponent is able to use a validator array where each validator is implementing \LokiCheckout\Validator\Component\AddressFieldValidatorInterface. This array is empty by default, but you could easily just override this yourself.
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="LokiCheckout\Component\Checkout\Address\Postcode"> <arguments> <argument name="validators" xsi:type="array"> <item name="postcode" xsi:type="string">postcode</item> </argument> </arguments> </type> </config>
More docs coming soon
Last modified: May 13, 2026