Skip to main content
When adding custom functionality to this extension, make sure to create your own plugin. Otherwise, you may interfere with the existing code and risk breaking it.

How to add custom attributes to the Contact

To store custom attributes for a contact in Engage, these plugins can be used:

How to add custom data to the Order

This guide walks you through adding custom key-value pairs to the extra_data field in the api/v2/orders payload sent to Voyado. You do this with a Magento after-plugin — no modification to the Voyado extension source is needed.

Before you start

  • You need a working Voyado Adobe Commerce integration.
  • All customizations must live in a separate Adobe Commerce module that depends on Voyado_Magento2. Do not edit the extension’s files directly — your changes would be overwritten on the next Composer update.

How extra data works

Every order exported to api/v2/orders includes an extra_data object. This is a flat string-to-string map — both keys and values must be strings. The extension populates it by default with shipping, billing, and payment details. The extension calls getExtraDataForOrder() in Voyado\Magento2\Helper\VoyadoHelper to build this map. You extend it with an afterGetExtraDataForOrder plugin that receives the existing array and returns it with your additions.
The Voyado API model types extra_data as map[string,string]. All values must be strings. If you pass a nested array or object, the serializer will cast it to the string "Array", which is not what you want. To include structured data, JSON-encode it into a string value as shown below.

How to create the module

Create app/code/VendorName/ExtendedVoyado/registration.php:
Replace VendorName with your own vendor name throughout this guide.
Create app/code/VendorName/ExtendedVoyado/etc/module.xml:
Create app/code/VendorName/ExtendedVoyado/etc/di.xml:
Create app/code/VendorName/ExtendedVoyado/Plugin/AddExtraOrderData.php.The plugin receives the existing extra_data array in $result — which already contains all the default fields like shipping address, billing address, and payment method. You add your field to this array and return it. Nothing else in the payload is affected.In this example, we read a custom order field called discount_code and add it as discountCode in the extraData object:
After this plugin runs, the extraData object in the api/v2/orders payload will contain your new field alongside all the existing fields:
The $result parameter contains the full existing extra_data array built by the extension. By adding a key and returning the array, your field is merged into the same object. You are not creating a new object — you are extending the one that already exists.
All values in extra_data must be strings. The Voyado API model types this field as map[string,string]. If you pass a non-string value (e.g. an integer or array), cast it with (string) or use json_encode() for complex types.
Run the standard Magento setup commands:
Then place a test order and check the voyado_magento2_status table. Look at the request column for the order export — your new fields should appear in the extraData object of the JSON body.
The extension populates these fields by default. Your plugin adds to this — it does not replace it.
Do not overwrite any of these default keys unless you specifically intend to replace their values. Your plugin receives the full existing array in $result — add to it, do not reassign it.

Common mistakes