The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Add a Custom Message Before the WooCommerce Cart

Shared by Amit Dholiya · August 19, 2026 · @woocommerce_before_cart

29 views
1 upvote
Back to Snippets

You can display a custom notice at the top of the WooCommerce Cart page. This is useful for showing shipping offers, discount information, delivery times, or important store announcements.

Steps

  1. Open your theme’s functions.php file.
  2. Add the code below.
  3. Save the file.
  4. Open your WooCommerce Cart page.

Done — the custom message will appear above the cart contents.

function add_custom_message_before_cart() {
    echo '<div class="custom-cart-notice">
        🎉 Free shipping on orders over $100!
    </div>';
}

add_action(
    'woocommerce_before_cart',
    'add_custom_message_before_cart'
);
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments