Showing and updating a message at the cart

This documentation is for the WooCommerce Advanced Messages plugin.

When creating a message this will always be refreshed as soon as the page is refreshed. On some pages on the site such as the cart not the entire page will refresh, but the important part, the cart contents, will be updated.

If you have a message setup that is based on the cart totals it would be nice to have the message updated too when the cart is updated through AJAX. Below I'll explain how you can setup a notice in the cart that will always be updated when the cart is also updated

Setting the location

There are some handy locations such as 'before cart', but this location won't get updated when the cart get updated when you're changing the quantity for example. Instead you want to choose 'custom' here and set the text field to woocommerce_before_cart_table

This location is above the cart just like a notice would be, but within the table that is being refreshed when the cart updated.

Setting the message

You can set any type of message here. If you just want to with a regular text you're done now, if you want to display a notice just like the 'info notice' location option you can add a little bit of HTML markup to ensure it looks like that:

<div class='woocommerce-info'>Your message here</div>

Still need help? Contact Us Contact Us