# Backorder Notice in the Cart and Checkout

> Warns customers in the cart and at checkout which of their items are on backorder and roughly when they will ship, so nobody is surprised by a delay.

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

## Code

```php
$wpide_backorder_eta = '7 to 10 working days'; // Expected dispatch time for backorders.

$wpide_backorder_notice = function () use ( $wpide_backorder_eta ) {
    $names = array();

    foreach ( WC()->cart->get_cart() as $item ) {
        $product = $item['data'];

        if ( $product->managing_stock() && $product->is_on_backorder( (int) $item['quantity'] ) ) {
            $names[] = $product->get_name();
        }
    }

    if ( $names ) {
        wc_print_notice( sprintf( '%1$s %2$s on backorder and will be dispatched in about %3$s.', esc_html( implode( ', ', $names ) ), 1 === count( $names ) ? 'is' : 'are', esc_html( $wpide_backorder_eta ) ), 'notice' );
    }
};

add_action( 'woocommerce_before_cart', $wpide_backorder_notice );
add_action( 'woocommerce_before_checkout_form', $wpide_backorder_notice, 6 );
```

## Notes

Set $wpide_backorder_eta to your usual restock time.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Backorder Notice in the Cart and Checkout" 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/
