# Intelligent Cart (AI)

URL: https://docs.sparklayer.io/help/ordering/intelligent-cart

Build B2B orders with SparkLayer Intelligent Cart by uploading a PDF, spreadsheet or photo, forwarding an email or scanning barcodes to fill the cart.

> **Quick summary**
>
> - Intelligent Cart uses AI to fill the cart from a file or email listing products and quantities, such as an invoice, purchase order or photo of a handwritten order. Customers can also scan barcodes with their camera.
> - Customers and sales agents use it in the [My Cart](https://docs.sparklayer.io/help/storefront/interfaces/my-cart.md), with **Upload a file**, **Forward an email** and **Scan barcode**.
> - The AI features and camera scanning are on the Starter plan and above (see [Plans and features](https://docs.sparklayer.io/help/plans-and-features.md)), and need the latest version of the [Core Script](https://docs.sparklayer.io/help/glossary.md#core-script) in your theme. Importing a CSV file or spreadsheet of SKUs, and using a handheld barcode scanner, work on every plan.
> - Uploaded and emailed data is never used for training, and is deleted within 24 hours.

## How it works

How Intelligent Cart builds a cart:

1. **Send the order**: Upload a file, forward an email or scan a barcode.
2. **AI reads it**: SKUs, barcodes and quantities are picked out.
3. **Products matched**: Only products that match your store are added.
4. **Review and check out**: Edit the cart as normal, then check out or request a quote.

| Feature | What it does | Plan |
| --- | --- | --- |
| **Upload a file** (AI) | Reads documents, spreadsheets and images: PDF, XLSX, PNG, JPG, CSV, TXT, JSON and DOCX. Recognised SKUs and quantities are added to the active cart. | Starter and above |
| **Forward an email** (AI) | Reads order details in the body or an attachment of a forwarded email, and fills the cart. | Starter and above |
| **Scan barcode** | Adds products by scanning their barcodes with a phone or computer camera. | Starter and above |
| [CSV import](#import-products-from-a-csv-file) | Adds products from a file with SKU (or barcode) and quantity columns, or rows pasted from a spreadsheet. | Every plan |
| [Barcode scanner](#use-a-barcode-scanner) | A handheld scanner types each barcode into the cart's search box, like a keyboard. | Every plan |

To try it, sign in to our [demo store](https://demo.sparklayer.io/pages/b2b-login-register).

## Set up Intelligent Cart

- **The latest version of SparkLayer** on your storefront. See the [frontend integration guide](https://docs.sparklayer.io/developers/frontend.md) for how to upgrade, or ask your developer.
- **The Starter plan or above.** See [Plans and features](https://docs.sparklayer.io/help/plans-and-features.md).
- **Barcodes on your products**, if you want barcode scanning. Add them in your eCommerce platform's admin. See [How products are shown](https://docs.sparklayer.io/help/storefront/product-display.md) for how barcodes show on your store.

To check it, sign in to your store as a B2B customer and open the cart. An empty cart shows shortcuts to **Upload a file**, **Forward an email**, **Scan barcode** and **Repeat order**. Once it has items, they're in the **Actions** menu next to the search box.

## Build a cart from a file

1. In the cart, click **Upload a file** (in the **Actions** menu once the cart has items).
2. Drop the file onto **Build a cart from a file**, or click **browse** and choose it. 
3. Within a few seconds, SKUs and quantities that match products in your store are added to the cart. Others aren't added.
4. Edit the cart if needed, then check out as normal.

For best results, use a file with SKUs or barcodes, such as an invoice or purchase order. From a previous invoice, for example, Intelligent Cart picks up each item's SKU and quantity.

The items are added to what's already in the cart. 

## Import products from a CSV file

Customers can add many products at once from a CSV file, by uploading it or by pasting rows from a spreadsheet. This works on every plan. 

1. In the cart, open **Actions** and choose **Upload a file**.
2. Drop the CSV file onto the upload box, or click **Paste rows**, paste the first two columns from a spreadsheet and add them.

Under the upload box, customers can download a **SKU template** or a **barcode template** to start from. By default, the file needs two columns with these headings:

| Ordering by | Columns |
| --- | --- |
| SKU | `sku` and `qty` |
| Barcode | `barcode` and `qty` |

```csv
sku,qty
abc123,10
xyz123,20
```

The products in the file are added to the cart. If a product must be ordered in packs, the quantity is rounded up to the nearest valid pack size.

### Rename the CSV column headings

You can give the columns names that suit your customers, for example `Item No.` and `Quantity` instead of `sku` and `qty`. The upload screen then shows your headings.

To do it without code, add translation overrides for these keys at **Storefront > Options > Translation overrides** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/storefront/options)), or **SparkLayer Wholesale > Storefront > Options > Translation overrides** in the Shopify app.

**For developers: set them in the Core Script**

Add these [text overrides](https://docs.sparklayer.io/help/storefront/languages-and-international.md) to your Core Script and change the values:

```javascript title="Core Script"
translations: {
  en: {
    "cart.import.csv-headers.sku": "Item No.",
    "cart.import.csv-headers.barcode": "Barcode No.",
    "cart.import.csv-headers.qty": "Quantity",
  }
}, 
```

## Build a cart from an email

1. In the cart, click **Forward an email**.
2. Click **Copy** to copy the customer's email address.
3. Forward the email with the order details, in its body or an attachment, to that address.
4. Within a few seconds, the cart shows **Email has been received**. Click **Populate cart from email**.
5. Edit the cart if needed, then check out as normal.

Each customer account has its own address, generated once for all future orders. It takes the form `ai+yourstoreid+has@b2b.sparklayer.io` and can't be changed. 

**Example: a sales agent forwards a customer's email**

A customer emails their sales agent asking for 20 of each of 4 SKUs. The agent signs in as that customer with [Sales agent ordering](https://docs.sparklayer.io/help/sales-ordering.md), copies the customer's address and forwards the email. The matching products are added to the cart at a quantity of 20.

## Scan a barcode

Barcodes are synced from your store (see [How products are shown](https://docs.sparklayer.io/help/storefront/product-display.md)), so add them to your products in your store admin first.

1. In the cart, click **Scan barcode**. The device needs a built-in camera.
2. Point the camera at a product barcode. If it matches an active product in your store, the product is added to the cart.

To remove **Scan barcode** from the cart, turn it off in the SparkLayer Dashboard.

### Use a barcode scanner

A handheld barcode scanner works on every plan, and suits warehouse or in-store ordering. It types each barcode into the cart's search box, like a keyboard, and the search box accepts both SKUs and barcodes.

1. Set up the scanner to type into the search box at the top of My Cart.
2. Open My Cart and scan. Each scanned product is added to the cart.

The search box needs to be on: see [Choose how customers search](https://docs.sparklayer.io/help/storefront/interfaces/my-cart.md#choose-how-customers-search).

## Check quantity rules on added items

Added items follow your inventory and product settings, such as [pack sizes and minimum or maximum quantities](https://docs.sparklayer.io/help/storefront/quantity-rules.md). If a quantity breaks a rule, such as ordering in multiples of 12, the cart shows an import notification, for example: "Your items have been added excluding the following: BRACE-GOLD - Example Bracelet - Quantity rounded to the nearest pack size".

The customer or sales agent can then edit the cart and check out, or submit a quote if you use the [Quoting Engine](https://docs.sparklayer.io/help/ordering/quoting.md).

## Hide Intelligent Cart

To remove the Intelligent Cart (AI) features from the cart, turn on **Hide AI features in the cart** at **Settings > Configurations > Pricing and cart** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/configuration/settings/general)), or **SparkLayer Wholesale > Settings > Configurations > Pricing and cart** in the Shopify app. It's the same setting as **Hide AI features in the cart** at **Storefront > Options > Checkout** in the SparkLayer Dashboard ([open](https://app.sparklayer.io/storefront/options)), or **SparkLayer Wholesale > Storefront > Options > Checkout** in the Shopify app.

## Data and privacy

SparkLayer never uses uploaded or emailed data for training. It's deleted as soon as the cart is filled, or within 24 hours if it isn't. See [Policies](https://docs.sparklayer.io/help/policies.md).

## FAQs

**Is this using artificial intelligence (AI)?**

Yes. It uses machine learning and related algorithms to scan, interpret and filter files and emails, only to build B2B orders.

**What file types can I upload?**

PDF, XLSX, PNG, JPG, CSV, TXT, JSON and DOCX: documents, spreadsheets and images. See [How it works](#how-it-works).

**Does uploading a file replace what's already in the cart?**

No. The items in the file are added to the cart.

**What if some SKUs are not recognised?**

They're ignored: only SKUs that match your products are added. You can edit the cart by hand afterwards.

**What are typical use cases?**

- Uploading an invoice, purchase order (PO) or other document to reorder items
- Uploading a spreadsheet (XLSX or CSV) of SKUs and quantities
- Taking a photo of a handwritten order, for example at a trade show
- Scanning barcodes in a shop or at an event
- Forwarding any of these, or a customer's email with a product list, by email

**Can customers use this on mobile devices?**

Yes. File upload, barcode scanning and email forwarding all work on mobile.

**Does it work offline?**

No. It needs an internet connection to process files, emails and barcode scans.

**How do I give feedback?**

Email our team at [product@sparklayer.io](mailto:product@sparklayer.io).
