The hyva_checkout.xml file
How Hyva Checkout uses hyva_checkout.xml
The hyva_checkout.xml configuration file is where you define checkout variants and their step sequences in Hyva Checkout. You can run multiple checkout configurations within a single Magento instance, each tailored to different store views or business requirements.
Place the file at etc/hyva_checkout.xml in either a module or a theme. Magento merges all hyva_checkout.xml files from active modules and from every registered theme into one configuration. That merged result determines which steps display and under what conditions.
Every Hyva Checkout configuration requires two things:
- A unique name used for references in other configuration files and layout handles.
- A human-readable label displayed in the admin dropdown. The label is optional in the schema, and a checkout without one is listed under its name.
You assign checkout configurations to specific Magento Websites or Store Views at Stores > Configuration > Hyvä Checkout > General > General > Checkout in the admin.
Reference file
The magento2-hyva-checkout module ships with a reference etc/hyva_checkout.xml that contains the default checkout configurations included with Hyva Checkout.
The hyva_checkout.xsd schema
The XML schema for hyva_checkout.xml is located in hyva-themes/magento2-hyva-checkout at src/etc/hyva_checkout.xsd. This schema defines all valid elements, attributes, and their relationships.
Steps vs. components
The hyva_checkout.xml file controls step order and visibility, not step content. The actual contents of each step - components like login forms, address lists, and quote summaries - are configured using layout XML, not hyva_checkout.xml.
Components can be shared between multiple steps or restricted to a single step, depending on your configuration.
Checkout config merging
All etc/hyva_checkout.xml files from active modules and from every registered frontend theme are merged to produce one global checkout configuration. The merged result is cached once and used for all store views.
The merge order determines priority. Later files override values from earlier files:
- All module
hyva_checkout.xmlfiles in module load order - The
hyva_checkout.xmlfiles of all registered themes
Theme files are not scoped to a store view
A theme's hyva_checkout.xml is merged even when the theme is not the active theme of the current store view, and even when no store view uses the theme at all. A change to an existing checkout or step in a theme file therefore applies to every store view that uses that checkout.
To customize the checkout for one theme or store view only, declare a new checkout with its own name (optionally with a parent) and select it in the system configuration of that store view. Do not rely on the merge order between themes that are not in the same fallback chain.
Checkout element attributes
The <checkout> element wraps one or more steps and defines a checkout variant. Here are the available attributes:
| Attribute | Required | Description |
|---|---|---|
name |
Yes | Unique identifier for the checkout. Used in other hyva_checkout.xml files and to construct layout handles. |
label |
No | Human-readable label shown in the admin checkout selection dropdown. Defaults to the checkout name. |
layout |
No | Default structure of a checkout step into which components can be arranged (e.g., 2columns). |
parent |
No | Name of a parent checkout configuration to inherit from. |
visible |
No | Whether this checkout appears in the admin selection dropdown. |
Step element attributes
Each <step> within a <checkout> represents a page the visitor sees during the checkout flow. Here are the available attributes:
| Attribute | Required | Description |
|---|---|---|
name |
Yes | Step identifier used in other hyva_checkout.xml files and to construct layout handles. |
label |
No | Displayed in the checkout step navigation on the front end. Passed through the __() translation function. The schema does not require it, but a step without a label has no text in the navigation. |
route |
No | URL segment for the step. Used for deep links. Defaults to the step name. |
layout |
No | Structure of the checkout step into which components can be arranged (overrides the checkout-level layout). |
remove |
No | Remove a step that was declared in a different hyva_checkout.xml file. |
ifconfig |
No | Only use the step if the given system config path has a truthy value. Negate with ! as the first character. |
before |
No | Name of another step before which this step should be placed. |
after |
No | Name of another step after which this step should be placed. |
clone |
No | Replicate a step from another checkout using a dotted path: {checkout_name}.{step_name} (since 1.1.17). |
Condition element attributes
The <condition> element controls step visibility. When multiple conditions exist on a step, the step only shows if all conditions are true.
| Attribute | Required | Description |
|---|---|---|
name |
Yes | Identifier for the condition, used for references in other hyva_checkout.xml files. |
if |
No | A condition class name (implementing Hyva\Checkout\Model\CustomConditionInterface) or a condition identifier string mapped to a class in frontend/di.xml. |
remove |
No | Remove a condition that was declared in a different hyva_checkout.xml file. |
before |
No | Evaluate this condition before the condition with the given name. |
after |
No | Evaluate this condition after the condition with the given name. |
method |
No | Name of the method on the condition class to call (defaults to validate). |
Update (handle) element attributes
The <update> element includes a layout XML handle in a step. You can make it conditional with the if attribute.
| Attribute | Required | Description |
|---|---|---|
handle |
Yes | Layout XML handle to include in the step. |
if |
No | Only include the handle if this condition is truthy. Accepts a class name or condition identifier, same as <condition>. |
method |
No | An alternative class method name (defaults to validate). |
processor |
No | An advanced option to specify a different layout handle processor. |
remove |
No | Remove the handle from the step. |
Complete annotated example
Here is a full hyva_checkout.xml example showing all available elements working together. This is a good starting point when creating your own checkout configuration.
<?xml version="1.0"?>
<!-- All hyva_checkout.xml files are merged at runtime into one configuration -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Hyva_Checkout:etc/hyva_checkout.xsd"
>
<!-- Define a checkout variant with a unique name and admin label -->
<checkout name="my-checkout" label="My Checkout" layout="2columns">
<!-- Define a step with a URL route and its own layout override -->
<step name="login" label="Customer Login" route="login" layout="1column">
<!-- Step conditions: all must be true for the step to show -->
<!-- "if" takes a registered condition identifier or a class name, "method" the method to call on it -->
<condition name="is_customer_required" if="is_customer" method="required"/>
<condition name="is_guest" if="is_guest"/>
<!-- Conditionally include a layout handle based on quote type -->
<update handle="my_virtual_quote_layout" if="is_virtual"/>
</step>
</checkout>
</config>
An unknown condition identifier hides the step
The if attribute must be a condition identifier that is registered in di.xml or a class name. The condition name is not looked up. If the value of if can't be resolved, Hyvä Checkout treats the step conditions as failed and hides the step without an error message. See Config step conditions for the built-in identifiers.
Related Topics
- Checkout layout handles - How to configure the content that appears within each checkout step using layout XML
- Config step conditions - How to create and use conditions that control step visibility