How to Display a Custom WooCommerce Message on Checkout – 2026

Last updated on September 1st, 2024 at 07:25 am

Customising your WooCommerce store is a powerful way to enhance user experience and drive conversions. One simple but effective modification is adding a custom message at checkout. This guide will walk you through how to add this custom functionality directly to your theme’s functions.php file, avoiding the need for additional plugins.

Why Custom Checkout Messages Matter

Custom messages at checkout can help in various ways, such as reminding customers of a special offer, providing essential information, or simply adding a personal touch. Since this method does not rely on external plugins, it ensures that your site remains lightweight and efficient.

Getting Started

Before we dive into the code, it’s crucial to create a child theme if you haven’t done so already. This ensures that any modifications you make are preserved even when you update your main theme. You can use our free child theme generator to get started quickly.

Adding a Custom Message to WooCommerce Checkout

To add a custom message to the WooCommerce checkout page, you’ll be working with the functions.php file of your child theme. The code snippet below will display a custom message to your customers at the checkout stage.

Customising your WooCommerce store

/**
 * Snippet: How to Display a Custom WooCommerce Message on Checkout – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1441
* Tested with WooCommerce 10.7.0
* "Adds a custom message to the WooCommerce checkout page"
*/ function wcsuccess_custom_checkout_message() { echo '<p class="custom-checkout-message">Thank you for shopping with us! Don’t forget to check out our latest offers.</p>'; } add_action('woocommerce_before_checkout_form', 'wcsuccess_custom_checkout_message');

In this example, the wcsuccess_custom_checkout_message function is hooked to woocommerce_before_checkout_form, meaning the message will appear just before the checkout form. You can easily change the position by selecting a different WooCommerce hook.

See also  Move email address field to top of Woocommerce checkout page

Customising the Message

The message displayed can be easily customised to fit your needs. For instance, if you want to add urgency or a call to action, simply edit the text within the <p> tags.

/**
 * Snippet: How to Display a Custom WooCommerce Message on Checkout – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1441
* Tested with WooCommerce 10.7.0
* "Adds a promotional message to the WooCommerce checkout page"
*/ function wcsuccess_custom_checkout_message() { echo '<p class="custom-checkout-message">Limited time offer! Use code SAVE10 at checkout to get 10% off your next purchase.</p>'; } add_action('woocommerce_before_checkout_form', 'wcsuccess_custom_checkout_message');

This snippet demonstrates how to include a promotional message. Just ensure the content aligns with your marketing goals.

Styling the Message

You can also style the message to match your theme. Add the following CSS to your theme’s stylesheet:

.custom-checkout-message {
    font-size: 16px;
    color: #333;
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin-bottom: 20px;
}

This CSS will style the message, making it stand out while still fitting within the overall design of your store.

Removing the Custom Message

If you ever need to remove the custom message, it’s as simple as removing the function from your functions.php file.

/**
 * Snippet: How to Display a Custom WooCommerce Message on Checkout – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1441
* Tested with WooCommerce 10.7.0
* "Removes the custom message from the WooCommerce checkout page"
*/ function wcsuccess_remove_custom_checkout_message() { remove_action('woocommerce_before_checkout_form', 'wcsuccess_custom_checkout_message'); } add_action('init', 'wcsuccess_remove_custom_checkout_message');

Best Practices

  1. Testing: Always test your code on a staging site before implementing it on your live site to avoid any disruptions.
  2. Backups: Regularly back up your functions.php file to prevent accidental data loss.
  3. Keep It Simple: While customising, avoid overloading your checkout page with too many messages or elements, as this can overwhelm the customer.
See also  How to add a custom WooCommerce checkbox checkout field 2026

Conclusion

Adding a custom WooCommerce message at checkout is a simple yet effective way to enhance user experience. By placing the code directly in your child theme’s functions.php file, you keep your site lightweight and avoid the pitfalls of plugin dependency. Don’t forget to create a child theme before making any changes, and feel free to explore other customisations to make your WooCommerce store truly unique.

By following this guide, you’ll be well on your way to creating a more engaging and customised checkout experience for your customers.

0 0 votes
Article Rating

Stay In Touch

Was this post helpful? Why not show your support and buy me a coffee?

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Scroll to Top
0
Would love your thoughts, please comment.x
()
x
×