Magento 2 B2B Commerce/Cloud how to import and export companies, requisition lists, shared catalogs and negotiable quotes

- E-Commerce, Magento 2, Our extensions

Magento 2 Commerce and Cloud editions comes with the B2B extension which is aimed at introducing companies and other features to Magento 2. If you are running a B2B store, you are probably aware of that.

When it comes to migration, import and export, however, there are limited options on what data you can get in and out.
With Firebear Studio Improved Import and Export extension you can now import and export every B2B entity in and out of Magento 2. Integrate your Magento 2 with CRM and ERP systems and get all data working on you.

What is it

Improved Import and Export with B2B Add-on by Firebear Studio is a Magento 2 extension which helps the store owners reduce management time with scheduled import and export jobs. The extension allows you to import and export every data you possibly use in your Magento 2 store.

With Improved Import extension you can now import and export Magento 2 B2B extension data, such as companies, shared catalogs, requisition lists and quotes which haven’t been covered yet by import and export.

The extension features include:

  • Import and export of all product types, product attributes, categories, orders, advanced pricing, CMS blocks and pages, cart price rules.
  • Entity attribute mapping – to make sure the imported and exported values are properly mapped with required Magento 2 attribute names.
  • Support of CSV, XML, Excel XLSX, OpenOffice ODS, Json file types.
  • Import table mapping for separators and other values.
  • XSLT templates for XML files. Import any XML file structure.
  • Support of direct file upload, FTP/SFTP, REST API, SOAP API, Dropbox.
  • Support of Google Sheets import. Tables can be imported directly from Google Sheets.
  • Price adjustments for imported products.
  • 100% open code, no limitations.
  • Customization module with the endpoints for building integrations.

Installing B2B Add-On for Improved Import and Export

NOTE: Before installing B2B Add-On make sure you have installed Improved Import and Export extension.

  1. Navigate to your store root folder in the SSH console of your server:

  2. Install B2B Add-On by running command:

  3. Enable B2B Add-On by running:

  4. Deploy content and flush store cache, log out from the backend and log in again. Run:


    and:

Congratulations, you have installed B2B Add-On for Improved Import and Export extension.

Magento 2 B2B entities: companies, quotes, requisition lists, shared catalogs

If you are conducting B2B sales you have probably heard of Magento 2 B2B extension. This is an official Magento 2 extension that brings in additional functionality to Magento 2 Commerce and Cloud editions.

Below I will describe each B2B entity in short. For an explicit description please read dedicated blog post on Magento 2 B2B.

Magento 2 B2B companies

The B2B functionality introduces additional customer entity – Companies. The Companies can be found under Customers > Companies.

The companies act as you would expect them. They are like customer groups, however with a personal admin, company email and credit balance. Customers can belong to a single company and to a single customer group.

Magento 2 B2B shared catalogs

Shared catalogs, are the product catalogs you share for a particular company. You can think of such catalogs are product catalogs for different store view. Basically, you can offer your B2B customers additional products, or the same products you offer to the general public however at the discounted price.

The shared catalogs can be found under Catalog > Shared Catalogs.

Here you can add new shared catalogs and assign them to a particular company.

Magento 2 B2B quotes and negotiable quotes

Quotes are basically the carts with products customers have added to them. Negotiable quotes, however, is a Magento 2 B2B functionality. It allows customers to ask for a reduced price for the order right from the shopping cart page.

The quotes can be found under Sales > Quotes.

The negotiable quotes contain all the data regarding the customer’s requests for lower prices and also contain the products customer has added to the cart. You can manage such requests by applying discounts and approving them.

Magento 2 B2B requisition lists

Requisition lists are the lists of products customers gather that can be conveniently added to the cart. This can be some office supplies, or weekly grocery lists. Basically these are the lists of any products customers are purchasing on a constant basis.

The requisition lists are composed by customers and can only be seen from under the customer’s account at the frontend.

The requisition lists are easy to compose and use. If you are building your store for B2B make sure to notify your customers of this feature.

Importing Magento 2 B2B entities

To import Magento 2 companies, quotes, requisition lists and shared catalogs we will be using Improved Import and Export extension with the B2B add-on. The extension itself is a powerful import and export tool, the B2B add-on brings in new Magento 2 B2B entities.

Check sample Magento 2 B2B entities import tables

The import process is the same as with the stand-alone Improved Import and Export extension. To import a particular entity navigate to System > Improved Import/Export > Import Jobs:

At the import job grid click ‘Add New Job’ button to create a new import job. The new job will meet you with the General Settings section:

Here you decide on the import job name and schedule. Make sure to use the name that you can later identify with the job. As for the frequency, you can decide if you want to run the job manually, or set it to run automatically on schedule.

When you are done with the General settings proceed to the Job settings:

Here you decide which entity you want to import. For Magento 2 B2B entities currently available:

  • Companies
  • Quotes and Negotiable Quotes
  • Shared Catalogs
  • Requisition Lists

Whenever the entity is selected you can proceed to the next section Import Behavior:

Here you select how you want to import the selected entity, either:

  • Add/Update
  • Replace existing
  • Delete existing

After the behavior selected proceed to the Import Source section:

Here you need to select:

  • Imported file type: CSV, XML, Json, XLSX, ODS
  • The source you will be importing from
  • Either upload or specify the link to the file you will be importing

That’s it for the general description of the how the import jobs work. For the full instructions on how to use the import jobs and description of the available options please read the extension manual.

Now let’s proceed to the B2B entities, their attribute and how to compose the import tables.

How to import Magento 2 B2B companies

To import companies one should use the import table with the company attributes. FireBear team composed the Magento 2 B2B Companies sample table in the Google Sheets. You can use this table as a starting point for importing your companies.

Below you can find the table with all B2B companies attributes, their description and sample values.

Attribute name Reference Values Value example
company_name Required attribute

Name of the company

Can contain any symbols My Company
status Required attribute


Indicates the status of the company

0 – pending approval

1 – active

2 – rejected

3 – blocked

1
company_email Required attribute


Email of the company. Please note that this is dedicated email of the company, not the company representative.

This field also serves as a unique company identifier.

Valid email address with the domain name test@test.com
sales_representative_id ID of the sales representative It is an ID of the admin account. To get the ID, navigate to System>Permissions>All Users and in the ID column check the ID 5
sales_representative_email Custom attribute.

Email of the sales representative’s account at the store.

Instead of using sales_representative_id. You can use this attribute to add a representative by account email.

If sales_representative_id has any value – it has a higher priority over sales_representative_email.

Any email address accepted

representative@test.com
legal_name Company Legal Name. Part of the account information.

Companies can have both name and legal name.

Can contain any symbols Company gmbh
vat_tax_id VAT of the company Can only contain valid VAT numbers EU999000999
reseller_id ID of the company’s reseller Can contain any symbols 321
comment Comment that can be left for the company. Visible only to the store administrator Can contain any symbols This company is the best
street Required attribute


Street value of the company’s legal address

Can contain any symbols First St.
city Required attribute


City value of the company’s legal address

Can contain any symbols New York
country_id Country value of the company’s legal address The Magento 2 code of the county

See this table for applicable values

US
region Region of the company address Region field is used for the Countries where you can’t select a region from the dropdown.

Here you are suggested to type the region name manually.

For countries with selectable regions use region_id column.

Moscow Oblast
region_id Region of the company address region_id field is used for the countries where you CAN select a region from the dropdown.

Here you are suggested to type the region code of the country.

For countries with NON selectable regions use region column.

Magento 2 region codes can be found here

14
postcode Required attribute


Postcode value of the company’s legal address

Can contain only numerals 12345
telephone Required attribute


Telephone value of the company’s legal address

Can contain only numerals 123123123
customer_group_id Required attribute


Customer group ID of the company. Mainly used to identify with which shared catalog the company is associated.

Can be found at the Customers>Customer Groups grid

Can contain only numerals

12
customer_group_code Customer group NAME of the company. Mainly used to identify with which shared catalog the company is associated. Instead of using customer_group_id. You can use this attribute to assign a group by the name.

If customer_group_id has any value – it has a higher priority over customer_group_code.

Default
reject_reason Reason the company has been rejected from approval Can contain any symbols I don’t like their colors
website_id ID of the store view, the company belongs to Can contain only numerals 2
email Email address of the company’s admin – a customer account that can run the company from the store’s frontend Valid email address with the domain name test@test.com
prefix Prefix of the company’s admin name Can contain any symbols Mr.
job_title Required attribute


Job title of the company’s admin

Can contain any symbols CEO
firstname First name of the company’s admin Can contain any symbols John
middlename Middle name of the company’s admin Can contain any symbols Jr.
lastname Last name of the company’s admin Can contain any symbols Doe
suffix Suffix of the company’s admin name Can contain any symbols esq.
gender Gender of the company’s admin empty – no gender specified

1 – male

2female

2
credit_limit Credit limit of the company’s credit Can contain only numerals 10000
balance Outstanding balance of the company Only numerals are allowed 5000
currency_code Credit currency of the company Only currency codes are allowed USD
exceed_limit Allow To Exceed Credit Limit setting 1 – company can exceed credit limit

0 – company canNOT exceed credit limit

1
credit_comment Comment on changing the credit and credit balance Can contain any symbols Confirmed with John Doe
is_quote_enabled Allow Quotes setting of the company. Allows companies ask for negotiable quotes at the shopping cart page. 1 – quote enabled

0 – quote disabled

1
applicable_payment_method IDs of the applicable payment methods of the company’s account Can contain only numerals 12
use_config_settings Defines if the default store configuration should be applied to the applicable payment methods of the company 1 – default store configuration

0 – custom payment methods

1
available_payment_methods Codes of the payment methods available for the company at the store Can contain any symbols amazon_payment

These are all the attribute which available for the companies in Magento 2 B2B extension. Some attributes are required, and the other are not.

What else you should know about companies import:

  • To create a company you can use only required attributes in your table.
  • When creating companies via the import process. The company super-user customer account can be created automatically using email, firstname and lastname attributes you specify for the company.

Assigning sales representative by email

By default Magento 2 allows you to assign a sales representative to the company only by the admin account ID, which can be found under System>Permissions>All Users in the ID column. This is done using sales_representative_id column of the import file. However, if you want to assign a sales representative by the account email you need to use another attribute.

Firebear team added a new column sales_representative_email. In this column you can put an email associated with the admin account and assign a sales representative using the email.

NOTE: if for the same company both sales_representative_id and sales_representative_email attributes/columns have values, only the value of the sales_representative_id will be considered.
Sales_representative_id has priority over sales_representative_email.

Assigning customer group by name

By default Magento 2 allows you to assign a company to the customer group only by the customer group ID, which can be found under Customer>Customer groups in the ID column. This is done using customer_group_id column of the import file. However, if you want to assign a company to the group using the NAME of the customer group you need to use another attribute.

Firebear team added a new column customer_group_code. In this column you can put a name of the customer group the company should belong to. This way you can use a customer group name.

NOTE: if for the same company both customer_group_id and customer_group_code attributes/columns have values, only the value of the customer_group_id will be considered.
Customer_group_id has priority over customer_group_code.

How to import Magento 2 B2B shared catalogs

To import shared catalogs one should use the import table with the shared catalog attributes. FireBear team composed the Magento 2 B2B Shared Catalog sample table in the Google Sheets. You can use this table as a starting point for importing your Shared Catalogs.

Below you can find the table with all B2B companies attributes, their description and sample values.

Attribute name Reference Values Value example
name Name of the shared catalog. Also the name of the customer group associated with the shared catalog.

If you are importing a shared catalog with a particular name, and there is no customer group with such name – the custom group will be created automatically.

Can contain any symbols Test Shared Catalog
description Description of the shared catalog. For internal identification purposes. Can contain any symbols This is a test shared catalog I’ve created
tax_class_id ID of the Customer Tax Class applied to the Shared catalog. Can contain only numerals 2
type Type of the shared catalog. For ALL shared catalogs can only be a single type: custom.

Public catalog is the general product catalog available for general public.

0 – custom catalog

1 – public catalog

0
company Email of the company associated with the Shared Catalog.

Please note that this is a COMPANY EMAIL, not the email address of the company’s administrator.

Valid email address with the domain name.

Multiple company emails can be entered separated by comma.

Make sure you don’t put spaces after comma.

john@doe.com,jane@roe.com
category IDs of the categories included in the shared catalog.

Please note, that if you include a category to the Shared Catalog – all its product will be included in the catalog.

Can contain only numerals.

Multiple category IDs can be entered separated by comma.

Make sure you don’t put spaces after comma.

1,2,3
sku SKUs of the products included in the shared catalog. If you don’t want to include whole categories – you can include only particular SKUs to the Shared Catalog. Can contain symbols allowed for SKUs.

Multiple SKUs can be entered separated by comma.

Make sure you don’t put spaces after comma.

PRDCT1,PRDCT2

These are all the attribute which available for the shared catalog in Magento 2 B2B extension.

What you should know:

  • If we specify the company email for the catalog, after the catalog is created – the company’s customer group will be changed to that of the shared catalog. This is a native Magento 2 behavior as shared catalogs are assigned by customer group.
  • If the category you tie to the shared catalog does not contain any products it will be tied to the shared catalog anyways.

Importing prices for the products in shared catalog

Shared catalogs allow setting up different prices for the products. These prices are assigned to products using native Magento 2 tier pricing functionality which is called ‘Advanced Pricing’.

The ‘Advanced Pricing’ is assigned per customer groups as well as Shared Catalogs. That’s why Magento 2 uses tier prices.

If you want to import shared catalog with different prices assigned you will need to use two different import jobs. First job with entity=Advanced Pricing, the other one with entity=Shared Catalog.
To learn how to import Advanced Pricing to Magento 2 read our dedicated blog article.

How to import Magento 2 B2B requisition lists

To import requisition lists one should use the import table with the requisition list attributes. FireBear team composed the Magento 2 B2B Requisition List sample table in the Google Sheets. You can use this table as a starting point for importing your Shared Catalogs.

Below you can find the table with all B2B companies attributes, their description and sample values.

Attribute name Reference Values Value example
customer_id ID of the customer the requisition list belongs to Make sure to specify the IDs only for the existing customers. Else you might get errors 26
name Name of the requisition list Can be any value John
description Description of the requisition list Can be any value Office monthly
item:sku SKUs of the items added to the requisition list Make sure to add only the items from the product catalog available for the customer ITM001
item:store_id ID of the store view the product in the requisition list belongs to.

When adding products make sure that products are available for the proper store views.

Make sure to add only existing store view IDs 10
item:qty Qty of the items in the requisition list Only numerals are allowed 15
item:options If the product has options, make sure to specify them for the requisition lists Codes of the complex product variations. Such as variations of configurable products.

How to import Magento 2 B2B quotes and negotiable quotes

Quotes and Negotiable Quotes comes as a single import/export entity ‘Quotes’ in the B2B add-on for Improved Import and Export Extension. Quotes and Negotiable quotes both use the same main table, however, for negotiable quote more database tables are used, the tables containing totals etc.

When importing quotes and negotiable quotes there will be two types of tables you are interested in.

First table is for regular quotes i.e. abandoned carts. Quotes are basically a set of products customer has added to the cart. So when importing quotes you will only require a limited set of attributes.

Check Magento 2 B2B quotes (abandoned cart) sample table

Second table if for negotiable quotes i.e. B2B Magento 2 functionality. These are also sets of products, the carts, for which customers requested a negotiation on price. Such tables come with additional attributes, which regulated the discount type, the discount amount etc.

Check Magento 2 B2B negotiable quote sample table

Quote (abandoned cart) table

Attribute name Reference Values Value example
increment_id Increment ID of the quote. Is used for internal identification purposes. Can be any UNIQUE value. Make sure that the value are unique to be able to find the quotes later on.

This unique identifier can be typed in manually, or any formula.

increment_id is used to later identity this particular quote you import.

10001
store_id ID of the store view the quote is available for. Make sure to add only existing store view IDs 10
customer_email Email of the custom account the quote belongs to Make sure that the quote belongs to the existing customers. Else errors may occur. john@doe.com
item:sku SKUs of the items in the cart Make sure to add only the items from the product catalog available for the customer ITM001
item:qty Qty of the item added to the cart Only numerals allowed.

Make sure you do not add qty that exceeds the product stock value.

100
item_option:code Code of the product option that is added to the cart Codes of the complex product variations. Such as variations of configurable products.
item_option:value Value of the product option that is added to the cart Values of the complex product variations. Such as variations of configurable products.

Quotes (abandoned carts) can only be imported for the registered customers. It is a Magento 2 limitation that doesn’t have any particular ties of the quotes to guest customers. Please remember this when importing quotes.

Increment_ID is specified manually. If you are EXporting quotes, Magento 2 won’t have any unique identifiers. However, when you are IMporting quotes, you need to have increment_ids filled it. You can do it via simple formulae.

Negotiable quote table

Attribute name Reference Values Value example
increment_id Increment ID of the quote. Is used for internal identification purposes. Can be any UNIQUE value. Make sure that the value are unique to be able to find the quotes later on.

This unique identifier can be typed in manually, or any formula.

increment_id is used to later identity this particular quote you import.

10001
store_id ID of the store view the quote is available for. Make sure to add only existing store view IDs 10
customer_email Email of the custom account the quote belongs to Make sure that the quote belongs to the existing customers. Else errors may occur. john@doe.com
item:sku SKUs of the items in the cart Make sure to add only the items from the product catalog available for the customer ITM001
item:qty Qty of the item added to the cart Only numerals allowed.

Make sure you do not add qty that exceeds the product stock value.

100
item_option:code Code of the product option that is added to the cart Codes of the complex product variations. Such as variations of configurable products.
item_option:value Value of the product option that is added to the cart Values of the complex product variations. Such as variations of configurable products.
negotiable:negotiated_price_type Negotiated Price type. This field is optional. The following values allowed:

1 – Percentage Discount

2 – Amount Discount

3 – Proposed Price

If no value specified ‘Percentage Discount’ – 1 will be used as a default value.

2
negotiable:negotiated_price_value Negotiated Price value. This field is optional. Only numerals allowed 200
negotiable:quote_name Name of the negotiable quote the customer specifies when requesting a discount Can be any value John’s quote
negotiable_comment:creator_type Defines whose comment is it. The comments can be left by store administrator and customer.

This field is optional.

Allowed values:

2 – Store Administrator

3 – Customer

Works in conjunction with ‘negotiable_comment:creator_id‘ attribute. Where ID of the commenter must be specified.

3
negotiable_comment:creator_id ID of either admin user or customer.

This field is optional.

Only numerals allowed.

Works in conjunction with the ‘negotiable_comment:creator_type‘ attribute.

11
negotiable_comment:comment Comment for the negotiable quote. From either admin user or customer.

This field is optional.

Any value allowed.

Works with ‘negotiable_comment:creator_type‘ and ‘negotiable_comment:creator_id‘ attributes.

12
negotiable_comment:created_at The date the comment has been added to the negotiable quote.

This field is optional.

Only date and time value allowed.

The format is YYYY-MM-DD HH:MM:SS

2018-11-01 17:16:16
negotiable_comment_attachment:file_name The name of the file attached to the negotiable quote comment. Can be any value.

Make sure to specify the full file name, including file type.

file_sample.png
negotiable_comment_attachment:file_path Path to the file attached to the negotiable quote comment Can be any value.

Make sure to specify path in reference with the root Magento 2 catalog – Magento 2 installation folder.

pub/images/

When importing negotiable quotes please note:

  • If customer is not allowed to ask for the negotiable quotes, an error will be displayed when trying to create a negotiable quote during import. In such cases make sure the customer is allowed to ask for negotiable quotes.
  • You can only import negotiable quotes for the registered customers.
  • For every comment for negotiable quote you need to use a separate row in the table. You only need to specify the increment_id of the quote one. The extension will understand that all comments belong to the specified increment_id until a new row with another increment_id is processed – then the extension will switch to this very increment_id.
  • The increment_id is a custom attribute we have added for the quote identification purposes. The quotes in Magento 2 do not have unique identifiers, so we had to identify them for proper updates.
  • The increment_id SHOULD BE specified manually if you want to import quotes. If you are EXporting quotes, Magento 2 won’t have any unique identifiers. However, when you are IMporting quotes, you need to have increment_ids filled it. You can do it via simple formulae.

Exporting Magento 2 B2B entities

Improved Import and Export extension allows exporting all Magento 2 B2B entities along with importing them.

To export any B2B entity into the required file format (CSV, XML, Json, XLSX, ODS) proceed to System > Improved Import/Export > Export Jobs.

Here you need to click ‘Add New Job’ to create an export job. The export jobs are similar to the import jobs, except that you can specify the filters for the exported entities and other matters of convenience.

Otherwise, if you want to learn more about how the export jobs work, please read Improved Import and Export extension manual.

This guide to importing and exporting Magento 2 b2b entities is a part of the blog post series that cover how to import and export EVERY Magento 2 entity in detail. For the full list of guides please read:

Magento 2 import and export guide list

Don’t forget to bookmark Guide List and B2B Master Table for further reference.