Skip to content

Magento V2 Company XML

The XML format documented here is used for the import of companies into Magento, via the Import Companies to Magento V2 task.

Companies are part of the B2B features of Adobe Commerce. For the Amasty B2B extension, see Magento V2 Amasty Company XML instead.

Every company needs a company admin, which is an existing Magento customer. Identify them with super_user_id or customer_email, or send a customer element to have Zynk create the customer as part of the import.

Sample XML

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfCompany xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Company>
    <external_id>ZYNK0001</external_id>
    <company_name>Zynk Software</company_name>
    <legal_name>Zynk Software Limited</legal_name>
    <company_email>[email protected]</company_email>
    <vat_tax_id>GB123456789</vat_tax_id>
    <status>1</status>
    <street>
      <string>Nelson House</string>
      <string>Jesmond</string>
    </street>
    <city>Newcastle</city>
    <postcode>NE2 3AE</postcode>
    <region>Tyne &amp; Wear</region>
    <country_id>GB</country_id>
    <telephone>214153215</telephone>
    <customer_group_id>1</customer_group_id>
    <customer_email>[email protected]</customer_email>
    <credit>
      <credit_limit>5000</credit_limit>
      <currency_code>GBP</currency_code>
      <exceed_limit>false</exceed_limit>
    </credit>
  </Company>
</ArrayOfCompany>

Company

Magento Field XML Field Type Input Notes
ID id int Optional The Magento company ID. When supplied, the company with this ID is updated
Company Name company_name string Required Also used for matching existing companies when no id is supplied
Legal Name legal_name string Optional
Company Email company_email string Required
VAT/TAX ID vat_tax_id string Optional
Reseller ID reseller_id string Optional
Status status int Optional Valid values are listed below
Comment comment string Optional
Street Address street/string string Required One string element per address line
City city string Required
Zip/Postal Code postcode string Required
State/Province region* string Conditional The name of the region
State/Province region_id* string Conditional The Magento region ID
Country country_id string Required The two letter ISO country code, e.g. GB
Phone Number telephone string Required
Customer Group customer_group_id int Optional The group all customers of this company belong to. Use instead of customer_group_code
Customer Group customer_group_code string Optional The code of the customer group, e.g. Wholesale. Zynk looks the group up in Magento. Use instead of customer_group_id
Company Administrator super_user_id* int Conditional The Magento customer ID of the company admin
Company Administrator customer_email* string Conditional The email address of an existing Magento customer to use as the company admin
Company Administrator customer* element Conditional A full customer record to create and use as the company admin, in the Magento V2 Customer XML format
Sales Representative sales_representative_id int Optional The Magento admin user ID of the sales representative
Reject Reason reject_reason string Optional
Rejected At rejected_at string Optional
  • region*, region_id* - Required for countries where Magento holds a region list, e.g. the United States. Send either region or region_id
  • super_user_id*, customer_email*, customer* - A company must have an administrator. Send one of these to set it

  • status - Valid values, as defined by Adobe Commerce:

Value Meaning
0 Pending Approval
1 Active
2 Rejected
3 Blocked

Credit

The company credit limit, sent in a credit element.

Magento Field XML Field Type Input Notes
- id int Optional
- company_id int Optional
Credit Limit credit_limit decimal Optional
Outstanding Balance balance decimal Optional
Currency currency_code string Optional e.g. GBP
Allow to Exceed Credit Limit exceed_limit bool Optional
Available Credit available_limit decimal Optional

Extension Attributes

Payment and shipping method restrictions for the company, sent in an extension_attributes element.

Magento Field XML Field Type Input Notes
Applicable Payment Methods applicable_payment_method int Optional 0 for all enabled payment methods, 1 for selected methods only
Payment Methods available_payment_methods string Optional A comma separated list of payment method codes
Use Default B2B Payment Settings use_config_settings int Optional 0 for false, 1 for true
Enable Purchase Orders is_purchase_order_enabled bool Optional
Applicable Shipping Methods applicable_shipping_method int Optional 0 for all enabled shipping methods, 1 for selected methods only
Shipping Methods available_shipping_methods string Optional A comma separated list of shipping method codes
Use Default B2B Shipping Settings use_config_settings_shipping int Optional 0 for false, 1 for true

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
<Company>
  <company_name>Zynk Software</company_name>
  <errors>
    <error>
      <name>Pre-Validation</name>
      <description>company_email must be specified for a new company</description>
    </error>
  </errors>
</Company>