> ## Documentation Index
> Fetch the complete documentation index at: https://docs.global-e.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MID Support

U.S. Customs requires the **Manufacturer's Identification Code (MID)** for certain shipments to the United States. MID data describes the manufacturer of the goods and is sent to Global-e as product metadata on the **SendCart** request.

<Note>
  This is an optional feature. The Global-e cartridges expose the [`globale.getPLICustomMetadata`](/hooks-sfcc#globalegetplicustommetadata) hook so you can supply MID fields per product line item, but there is no out-of-the-box handler — you must implement the hook in your project cartridge.
</Note>

<h2 id="mid-support-339081">
  What is Manufacturer's Identification
</h2>

Manufacturer's Identification (MID) includes the full business name and postal address of the manufacturing supplier, plus a specific code derived from the manufacturer's name and country. U.S. customs uses this information on qualifying shipments.

## When MID is required

MID is required when **either** of the following applies:

* Any order shipped to the **United States** that includes at least one product **manufactured in China or Hong Kong**, regardless of order value.
* Any shipment to the **United States** with a declarative value to customs **higher than USD 2,500**, regardless of the country of origin of the products.

## MID fields

Configure the following values for each product that needs MID data:

| Field | Description |
| - | - |
| **MIDCode** | A unique identifier generated from the manufacturer's name and location. |
| **MIDAddress** | The full postal address of the manufacturing supplier. |
| **MIDName** | The complete business name of the manufacturing supplier. |

### Generating an MID code

If the MID code is not already stored in your catalog or PIM, generate it from the supplier's business name and postal address:

1. **Collect supplier information** — obtain the manufacturer's complete business name and postal address.
2. **Build the MID code** using these parts (in order):
   1. The two-letter ISO country code for the supplier's country (for example `GB`, `NL`, `DE`).
   2. The first three letters of the supplier's first and second names (when applicable).
   3. The highest numerical digits (up to four) from the address line.
   4. The first three letters of the supplier's city name.

**Example**

| Input | Value |
| - | - |
| Supplier | Ozrock, 92 Alice Springs Road, Melbourne, Victoria, Australia, 3001 |
| **MIDCode** | `AUOZR92MEL` |

### MID Address and MID Name

No special formatting is required for **MIDAddress** or **MIDName**. Use the values exactly as provided by the supplier.

**Example**

| Field | Value |
| - | - |
| **MIDAddress** | 92 Alice Springs Road, Melbourne, Victoria, Australia, 3001 |
| **MIDName** | Ozrock |

## Sending MID data from SFCC

The Global-e cartridges add product metadata to the SendCart payload from the [`globale.getPLICustomMetadata`](/hooks-sfcc#globalegetplicustommetadata) hook. For each product line item, the hook return object is merged into `Product.MetaData.Attributes` as `AttributeKey` / `AttributeValue` pairs (`int_globale/cartridge/scripts/helpers/globaleProductLineItemHelpers.js`).

**Important:** the attribute keys must be set **exactly** as shown below (all lowercase):

| AttributeKey | Maps to |
| - | - |
| `midcode` | MIDCode |
| `midname` | MIDName |
| `midaddress` | MIDAddress |

Example SendCart product metadata:

```json theme={null}
{
  "MetaData": {
    "Attributes": [
      { "AttributeKey": "midcode", "AttributeValue": "AUOZR92MEL" },
      { "AttributeKey": "midname", "AttributeValue": "Ozrock" },
      { "AttributeKey": "midaddress", "AttributeValue": "92 Alice Springs Road, Melbourne, Victoria, Australia, 3001" }
    ]
  }
}
```

## Required customization

Register a handler for `globale.getPLICustomMetadata` in your project cartridge (or in `int_globale_sfra` / `int_globale_sitegenesis`, depending on your architecture).

`./hooks.json`

```json theme={null}
{
    "hooks": [
        {
            "name": "globale.getPLICustomMetadata",
            "script": "./cartridge/scripts/globale/hooks/getPLICustomMetadata.js"
        }
    ]
}
```

`./cartridge/scripts/globale/hooks/getPLICustomMetadata.js`

```javascript theme={null}
'use strict';

/**
 * Returns per-PLI metadata for the SendCart request.
 * @param {dw.order.ProductLineItem} productLineItem - Product line item
 * @returns {Object|null} - Key/value pairs added to Product.MetaData.Attributes
 */
exports.getPLICustomMetadata = function (productLineItem) {
    // Replace with your catalog / PIM / supplier lookup.
    var apiProduct = productLineItem.product;
    if (!apiProduct) {
        return null;
    }

    // Example: read from merchant-defined product custom attributes.
    // Define geMidCode, geMidName, and geMidAddress in your catalog metadata, or replace this lookup entirely.
    return {
        midcode: apiProduct.custom.geMidCode || '',
        midname: apiProduct.custom.geMidName || '',
        midaddress: apiProduct.custom.geMidAddress || ''
    };
};
```

The example assumes you define product custom attributes for MID data in your catalog metadata. You can source values from any system — ERP, PIM, supplier feed, or a custom object — as long as the hook returns the three lowercase keys for qualifying products.

Return `null` or omit keys when MID does not apply to a line item (for example, domestic-only products or shipments that do not meet the U.S. customs thresholds above).

## See also

* [SendCart and checkout flow](/checkout-flow-sfcc)
* [Hooks reference](/hooks-sfcc) — `globale.getPLICustomMetadata`
