Save hidden data to order

With order extra fields you can save any custom information into an order privately, optionally showing it in order details in storefront to customer or in the Ecwid Control Panel to merchant. This is helpful when you need to save some technical stuff like campaign id, referring website address or something else. Check out more details on how it works below.

Saving hidden data to order

Your hidden data will be saved into a config object used by Ecwid: ec.order and ec.order.extraFields. But in order to use it, you need to initialize it on a page. After you've initialized the extra fields object, we can save some value into an order. Check code example below on how to add a hidden extra field with the key platform and value adobe_muse.

// Initialize extra fields = || {};
ec.order = ec.order || {};
ec.order.extraFields = ec.order.extraFields || {};

// Save a single value for 'platform' field
ec.order.extraFields.platform = {
    'value': 'adobe_muse'

// Save another value for 'affiliate' field
ec.order.extraFields.affiliate = {
    'value': "Nick's warehouse"

window.Ecwid && Ecwid.refreshConfig();

If your code executed successfully, these fields will be saved when a customer places their order in an Ecwid store. See Get extra fields in REST API section to access them afterwards.


The codes for extra fields need to be added to the source code of your website or via an app for Ecwid, that customizes the storefront.