Skip to content

Basket / Order Custom Fields#


Basket Custom Fields#

Custom basket fields in Miva Merchant serve as a potent developer tool, enabling the storage of diverse data associated with shoppers or their respective baskets. Upon visiting a Miva Merchant store, visitors are automatically assigned a unique basket ID. Custom basket fields empower developers to associate data with these basket IDs. Conceptually akin to cookies used to retain data related to a specific customer session in a browser, custom basket fields perform the same function, albeit storing data in Miva’s database. It’s imperative to note that custom basket field data expires simultaneously with the associated basket. Miva automatically purges any custom basket fields linked to an expired basket.

Syntax#

  • Specify a unique code for the field to serve as an identifier.
  • If using Write_Basket assign the desired value to be stored in the field.
  • If using Read_Basket assign the desired variable to store that data.

Read Function#

<mvt:item name="customfields" param="Read_Basket( 'custom_field_code', l.settings:customfields )" />

Write Function#

<mvt:item name="customfields" param="Write_Basket( 'custom_field_code', 'value' )" />

Read All#

<mvt:item name="customfields" param="Read_Basket( '' )" />
<mvt:foreach iterator="basket" array="customfields">
     &mvte:basket:code; - &mvte:basket:value;<br/>
</mvt:foreach>

Order Custom Fields#

Custom order fields in Miva Merchant offer functionalities akin to custom basket fields, albeit focused on order data storage. Unlike custom basket fields, which are associated with baskets, custom order fields are linked to orders. Typically, custom order fields complement custom basket fields in a workflow where shopper data captured via a custom basket field transitions to a custom order field upon order placement. Crucially, this transition occurs automatically when the field codes for both custom basket and order fields match, simplifying data management for developers.

Syntax#

Read Function#

<mvt:item name="customfields" param="Read_Order( l.settings:order:id, 'custom_field_code', l.settings:customfields )" />

Write Function#

<mvt:item name="customfields" param="Write_Order( l.settings:order:id, 'custom_field_code', 'value' )" />

Implementation#

Adding a custom order field to an order:

  1. Capturing Order Notes: Incorporate input fields within checkout pages (e.g., OCST) to gather pertinent order details such as notes or special instructions.
  2. Transferring Data to Custom Basket Fields: On subsequent pages (e.g., OSEL), retrieve user-inputted data from global variables and save it to designated custom basket fields.
  3. Automatic Conversion to Custom Order Fields: Miva automatically converts relevant custom basket field data to custom order fields, ensuring seamless integration into order records without manual intervention.
  4. Admin Interface Integration: Configure custom order fields within the Admin interface under Utilities > Custom Fields to provide a structured framework for storing and accessing order-related data.
  5. Enhanced Order Management: Leverage custom order fields to streamline order processing, facilitate customer support activities, and generate comprehensive reports incorporating custom field data.

Summary#

Miva Merchant’s custom order fields empower developers to extend the platform’s capabilities by enabling the capture and management of diverse order-related data. Seamlessly integrated into the order processing workflow, custom order fields serve as valuable tools for enhancing data organization, facilitating customer interactions, and optimizing business operations. With automated data transfer and flexible configuration options, custom order fields offer a versatile solution for enriching order records and bolstering overall e-commerce functionality.