CSV Quote Import/Export Add-On

Use this add-on to move quote-domain records through Magento's standard CSV Import/Export screens or through entity-specific CLI import commands. It is intended for controlled migrations, repeatable setup, and bulk administration. It does not replace the customer-facing item CSV inside an individual quote.

This add-on is package: mageb2b/b2b-quote-importexport (module: MageB2B_B2BQuoteImportExport).

Supported Entities

Import and export:

  • Quotes
  • Quote items
  • Quote addresses
  • Quote messages
  • Projects
  • Categories
  • Tags
  • Statuses
  • Status transitions
  • Quote fees

Export only:

  • Quote revisions
  • Quote revision items

Admin Import/Export (Magento UI)

The module registers entities into Magento’s Import/Export system, so you can import/export from the backend:

  • System → Data Transfer → Import (select one of the B2B Quote entities)
  • System → Data Transfer → Export (select one of the B2B Quote entities)

Imports and exports respect Magento table prefixes, so installations with prefixed database tables can use the same entities and CLI commands.

B2B Quote entities in Magento Import and Export

CLI Usage

The module provides one import command per importable entity. Every command requires a CSV path and an explicit --behavior value.

B2B Quote project import from the Magento command line

Common command names:

php bin/magento b2bquote:import-quotes <file.csv> --behavior=append
php bin/magento b2bquote:import-quote-items <file.csv> --behavior=append
php bin/magento b2bquote:import-addresses <file.csv> --behavior=append
php bin/magento b2bquote:import-messages <file.csv> --behavior=append
php bin/magento b2bquote:import-projects <file.csv> --behavior=append
php bin/magento b2bquote:import-statuses <file.csv> --behavior=append
php bin/magento b2bquote:import-status-transitions <file.csv> --behavior=append
php bin/magento b2bquote:import-categories <file.csv> --behavior=append
php bin/magento b2bquote:import-tags <file.csv> --behavior=append
php bin/magento b2bquote:import-fees <file.csv> --behavior=append

Supported behaviors are append, add_update, replace, and delete. The command rejects a missing or unknown behavior before importing.

Common options:

Option Purpose
--behavior Required import behavior
--field_separator CSV field delimiter; comma is the default
--field_multiple_value_separator Separator for multi-value fields; comma is the default
--fields_enclosure Enable the configured field-enclosure handling
--delete_file_after_import 1 removes the source after a successful run; default is 1

Preserve the source file during an initial migration test:

php bin/magento b2bquote:import-projects \
  var/import/b2bquote_projects.csv \
  --behavior=append \
  --delete_file_after_import=0

Run php bin/magento list | grep b2bquote:import on the target installation to confirm the commands available there.

Validation and portable identifiers

  • Magento validates the complete CSV before import. When validation fails, the command prints the affected row and message and does not proceed.
  • Use an export from the target installation as the starting structure whenever possible.
  • Append imports for addresses and messages can resolve portable quote increment IDs. This is safer across installations than assuming internal quote entity IDs are identical.
  • Guest quotes exported with access tokens can be imported without a Magento customer account when the target add-on supports the guest-token columns. Treat the token as a secret during the transfer and mask it in reviews.
  • Spreadsheet programs can silently change identifiers, dates, decimal separators, or leading zeros. Review the saved CSV before import.
  • Test replace and delete behaviors on a database copy first; they can remove or overwrite domain data.

Import order and dependency rules

For a portable migration, import the records in this order:

  1. statuses and transitions;
  2. projects, categories, and tags;
  3. customer-owned quotes;
  4. quote items and quote addresses;
  5. messages, attachments, and fees;
  6. revisions after the quote history is stable.

Use stable customer identifiers, quote increment IDs, SKUs, and status codes. Internal numeric IDs can change between installations. A quote item needs its parent quote and product reference. A message or attachment needs its quote, and a transition needs source and target statuses in the same store scope.

The portable columns commonly include:

Entity Review these fields
Quote customer or guest identity, increment ID, store, status, expiry, PO, notes, totals, and access token policy
Item quote reference, product or SKU, quantity, catalogue price, offered price, counter price, options, and notes
Address quote reference, billing/shipping type, name, street, city, region, postcode, country, and telephone
Message quote reference, author, visibility, notification flag, text, and timestamp
Fee quote reference, code, label, amount, tax flag, and store scope
Revision quote reference, event, actor, snapshot, and parent revision

Do not import calculated totals as trusted values without recalculating the quote and comparing the result. Never include real passwords, private customer exports, or unmasked guest tokens in a CSV checked into source control.

Example CSV (Core Item Export)

For quick item editing inside a quote, the core module can export/import items with this format:

sku,qty,price,notes
B2BQ-OFFICE-001,10,299.99,"Delivery requested before the office refit"

This is separate from the Import/Export add-on entities and is described here:

Troubleshooting

The command reports an unknown behavior

Pass one of the four supported values explicitly. --behavior=append is the usual starting point for a new controlled import.

Validation fails before any rows are imported

Read the reported row messages, compare the header with an exported or sample file for the same entity, and retry with a small subset. Also verify delimiters and file encoding.

The CSV disappears after a successful run

The CLI default is to delete the imported file. Use --delete_file_after_import=0 while testing or when an external process owns archival of the source file.