> ## 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.

# EU Product Identifiers

Part of the [EU Customs Reform - Product Identifiers (PID)](https://docs.global-e.com/eu-product-identifiers-pid.md).

On WooCommerce, the Global-e plugin sends `standardcode` and `mididentifier` to Global-e at checkout. Your SKU is already sent separately, so there is no new SKU field to add.

For what each identifier is, see [The three identifiers](https://docs.global-e.com/eu-product-identifiers-pid.md#the-three-identifiers) on the overview page.

## Choose your setup

There are two ways to send the identifiers. Both need a developer to add a short code snippet, because WooCommerce has no built-in field for the manufacturer code. Pick the option that fits your store and follow only that section.

| Option | Use it when | `standardcode` (S-PID) comes from | `mididentifier` (NS-PID) comes from | Minimum versions |
| - | - | - | - | - |
| **A. Native GTIN field + code filter** (recommended) | You are on WooCommerce 9.2 or later | The native GTIN, UPC, EAN, or ISBN field, per variation | The code filter, per variation | Plugin **1.17.2**, WooCommerce **9.2** |
| **B. Code filter only** | You are on WooCommerce below 9.2, or your barcodes are stored outside WooCommerce | The code filter, per variation | The code filter, per variation | Plugin **1.14.0** |

You can check your plugin version by navigating to **Plugins → Installed Plugins**.

![](https://mintcdn.com/globale-enterprise/TSLEJxyEPjRJOJpp/images/eu-product-identifiers/woocommerce-plugin-version.png?fit=max\&auto=format\&n=TSLEJxyEPjRJOJpp\&q=85\&s=493330ee8dfd489d2aedd0f01e8d626e)

## Option A: Native GTIN field + code filter

**Requires:** Global-e WooCommerce plugin 1.17.2 or later, on WooCommerce 9.2 or later.

1. **Fill in the S-PID (`standardcode`).** Fill in **GTIN, UPC, EAN, or ISBN**. For a simple product, it's under Product data, then Inventory. For a variable product, fill it in on each variation (Variations, then open the variation). You can also fill it in on the parent product's Inventory tab: any variation without its own value uses the parent's value. No plugin setting is needed for this field.

   ![](https://mintcdn.com/globale-enterprise/NaDKZJBQKzig2Mzi/images/eu-product-identifiers/woocommerce-native-gtin-simple.png?fit=max\&auto=format\&n=NaDKZJBQKzig2Mzi\&q=85\&s=6e82acd2b70881e14d40831a5a7f8042)

   Simple product: Product data, then Inventory.

   ![](https://mintcdn.com/globale-enterprise/bNbyOWzwAlbV9q4r/images/eu-product-identifiers/woocommerce-native-gtin-variation.png?fit=max\&auto=format\&n=bNbyOWzwAlbV9q4r\&q=85\&s=b460fae45b3d9864f4ed40bac35c141f)

   Variable product: the field on each variation.

   ![](https://mintcdn.com/globale-enterprise/NaDKZJBQKzig2Mzi/images/eu-product-identifiers/woocommerce-native-gtin-parent.png?fit=max\&auto=format\&n=NaDKZJBQKzig2Mzi\&q=85\&s=4bda5908323857c06bc402c224d78d83)

   Variable product: the parent's Inventory tab, used for variations without their own value.

2. **Send the NS-PID (`mididentifier`) with the code filter.** Add the code from [The code filter](#the-code-filter) below, and remove the `standardcode` line from the example so the native field value is used.

3. Place a test order and confirm both keys appear when values exist and are omitted when blank.

## Option B: Code filter only

**Requires:** Global-e WooCommerce plugin 1.14.0 or later.

1. **Send both identifiers with the code filter.** Add the code from [The code filter](#the-code-filter) below, with both the `mididentifier` and `standardcode` lines.
2. Place a test order and confirm both keys appear when values exist and are omitted when blank.

If you later upgrade to WooCommerce 9.2 and plugin 1.17.2, you can move `standardcode` to the native field (Option A). Remove the `standardcode` line from the code when you do.

## The code filter

The plugin's `woocommerce_globale_pro_add_cart_product_meta_attributes` filter adds key/value pairs to each cart line's MetaData. Your developer decides where the values come from: for example, a custom field on each variation (added by your developer or a custom fields plugin), or an external system such as your ERP or PIM.

Example for your theme's `functions.php` or a custom plugin. Replace the meta keys with wherever you store the identifiers:

```php theme={null}
add_filter( \GCBWC\Globale\Pro\Model\Cart::FILTER_CART_PRODUCT_META_ATTRIBUTES, 'gcbwc_add_pid_meta_attributes', 10, 2 );

if ( ! function_exists( 'gcbwc_add_pid_meta_attributes' ) ) :
function gcbwc_add_pid_meta_attributes( $metaAttributes, $cart_item ) {
    // Read from the variation when there is one, otherwise from the product.
    $id = ! empty( $cart_item['variation_id'] ) ? $cart_item['variation_id'] : $cart_item['product_id'];

    // Replace these meta keys with wherever you store the identifiers.
    // Option A: remove the standardcode line.
    $pids = array(
        'mididentifier' => get_post_meta( $id, '_your_mididentifier_meta_key', true ),
        'standardcode'  => get_post_meta( $id, '_your_standardcode_meta_key', true ),
    );

    foreach ( $pids as $key => $value ) {
        if ( '' === trim( (string) $value ) ) {
            continue; // Leave the key out when there is no value.
        }
        $attribute = new \GCBWC\Globale\Pro\Api\Entity\CustomProductAttribute();
        $attribute->setAttributeKey( $key );
        $attribute->setAttributeValue( $value );
        $metaAttributes[] = $attribute;
    }

    return $metaAttributes;
}
endif;
```

* Use the keys exactly as written, in lowercase: `mididentifier` and `standardcode`.
* Leave a key out when there is no value. Never send NA, 0 or -.
* Send each key from one source only. If `standardcode` is in the native field, don't also send it with the filter.
* Test on a staging site first and confirm both keys appear on the cart line.

## Reference

**What gets sent**

| Sent as | What it holds | When to leave it out |
| - | - | - |
| **`standardcode`** | S-PID: the global standard code for that product or variation (GTIN, EAN, UPC or ISBN) | When the item has no S-PID. Global-e treats a missing S-PID as confirmation that none exists for that product. |
| **`mididentifier`** | NS-PID: the manufacturer's product code for that product or variation | Never. This is required on every line. |

**Key points**

* **Native field fallback.** For the native GTIN, UPC, EAN, or ISBN field, a variation without its own value uses the parent product's value.
* **Omit, don't fake.** Leave the value empty when you have none. Never enter NA, 0 or -.
* **When values are read:** at checkout, when the customer proceeds to Global-e. Updated catalog values apply on the next checkout.

**Quick check before go-live**

| Check | Done |
| - | - |
| You meet the minimum versions for the option you chose | ☐ |
| Option A: GTIN, UPC, EAN, or ISBN filled in, and the code filter sends `mididentifier` | ☐ |
| Option B: the code filter sends `standardcode` and `mididentifier` | ☐ |
| No `standardcode` or `mididentifier` attributes left in Extra Product Attributes | ☐ |
| `standardcode` and `mididentifier` appear in SendCart when the item has values | ☐ |
| Keys omitted (not empty) when an item has no value | ☐ |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.