Overview
The Magento 2 Order Restructure is a configuration-based transformer that restructures the raw order payload received from Magento 2 into a format suitable for further processing or delivery to a target system. It replaces the prototype-based magento2-order-restructure previously used in the Legacy Magento 2 Connector.
This component has been migrated from a prototype-based implementation to a configuration-based setup as part of the Legacy Magento 2 Connector replacement project.
Prototype vs Configuration-based
This is an important behavioral difference to understand before setting up this component.
| Prototype-based | Configuration-based |
|---|
| Reusability | Can be reused across different flows by changing a few fields | Not reusable across different purposes or payloads |
| Flexibility | One prototype can serve multiple use cases | (Not always) Each use case requires its own dedicated configuration |
| How to reuse | Modify fields directly | Duplicate the configuration and adjust as needed |
If you need to transform a different payload structure or serve a different use case, you must duplicate this transformer and adjust the configuration accordingly. Do not modify an existing configuration as another Route already uses it.
Type
Transformer
Purpose
This transformer takes the raw order data from Magento 2 and restructures it into a normalized format. This typically includes flattening nested structures, renaming fields, mapping values, and preparing the payload for the target system.
Configuration
| Parameter | Description | Required |
|---|
state | Set the field for state (state/status/both) | Yes |
mutation-storage | The storage to set the mutation date | Yes |
| | |
Usage
- Navigate to Transformers in your Alumio environment.
- Search for or create a new Magento 2 Order Restructure transformer.
- Configure the field mappings and optional parameters as described above.
- Add this transformer to the relevant route in the transformation step.
Deprecated VS New
An example of the deprecated configuration:
An example of the new configuration:
Notes
- Replaces the prototype:
magento2-order-restructure
- Unlike the prototype-based implementation, this configuration-based transformer is not reusable across different purposes or payloads. If you need to transform a different payload structure or serve a different use case, you must duplicate this transformer and adjust the configuration accordingly.
- Field mapping should be reviewed carefully to ensure it matches the target system’s expected payload structure.