Skip to content

Magento V2 Customer Group XML

The XML format documented here is used for the import of customer groups into Magento, via the Import Customer Groups to Magento V2 task.

If the <id> element is supplied the group with that ID is updated, otherwise the group is matched on code. If no match is found a new group is created.

Sample XML

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Group>
    <id>4</id>
    <code>Wholesale</code>
    <tax_class_id>3</tax_class_id>
  </Group>
</ArrayOfGroup>

Group

Magento Field XML Field Type Input Notes
ID id int Optional The Magento group ID. When supplied, the group with this ID is updated
Group Name code string Required Also used for matching existing groups when no id is supplied
Tax Class tax_class_id* int Conditional The ID of the customer tax class. 3 is the ID of Retail Customer on a standard Magento installation
Tax Class tax_class_name* string Conditional The name of the customer tax class, e.g. Retail Customer. Zynk looks the tax class up in Magento
  • tax_class_id*, tax_class_name* - Required when creating a new group. Send either tax_class_id or tax_class_name

Common Fields

The following fields are supported on every record we import into Magento. They are used by Zynk rather than sent to Magento.

XML Field Type Input Notes
external_id string Optional The unique ID of the record in the external system. Stored in Zynk's internal DB and used to track records already imported. Required when the Prevent Reprocessing setting is enabled on the task
store_code string Optional The store view code to send this record to, overriding the Store View Code setting on the task for this record only
match element Optional Match an existing record on a field and value other than the default. See Matching Records in Magento v2
matches element Optional As match, but matching on more than one field. See Matching Records in Magento v2

Errors

Records which fail to import are written to the Fail File in the same format as the input file, with the reason for the failure added in an errors element. There is no need to send this element yourself.

The name of each error tells you at which stage the record failed:

Name Meaning
Pre-Validation Zynk checked the record before sending it and found a problem, e.g. a required field is missing or a related record could not be found. The record was not sent to Magento
Prevent Reprocessing A record with the same external_id has already been imported, and the Prevent Reprocessing setting is enabled on the task
Error Magento rejected the record, or Zynk could not match the record to the data already in Magento. The description contains the message returned by Magento
Upload Error An unexpected error occurred while sending the record to Magento
<Group>
  <tax_class_id>3</tax_class_id>
  <errors>
    <error>
      <name>Pre-Validation</name>
      <description>A customer group code must be provided.</description>
    </error>
  </errors>
</Group>