# Show SKUs in the Cart, Checkout and Orders

> Prints each product's SKU under its name in the cart, checkout and order details, which trade buyers and phone orders often need.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, sku, cart, checkout
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-sku-in-cart-items/

## Code

```php
add_filter( 'woocommerce_get_item_data', function ( $data, $item ) {
    $sku = isset( $item['data'] ) ? $item['data']->get_sku() : '';

    if ( $sku ) {
        $data[] = array( 'key' => 'SKU', 'value' => $sku );
    }

    return $data;
}, 10, 2 );

add_action( 'woocommerce_order_item_meta_start', function ( $item_id, $item ) {
    $product = is_callable( array( $item, 'get_product' ) ) ? $item->get_product() : null;

    if ( $product && $product->get_sku() && ! is_admin() ) {
        printf( '<br><small class="wpide-item-sku">SKU: %s</small>', esc_html( $product->get_sku() ) );
    }
}, 10, 2 );
```

## Notes

Variations show their own SKU, or the parent's if they have none.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Show SKUs in the Cart, Checkout and Orders" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
