1. WooCommerce Product Table
  2. Advanced Usage

How to change the 'View cart’ success message in the product table

Please note: this article is aimed at developers. If you don't have a developer who can implement this for you, we recommend posting a job on Codeable where their pre-approved WordPress experts will send you a quote.

Need professional assistance?
We've partnered with Codeable to provide our customers with expert help if required.

When you're using WooCommerce Product Table, customers can add products to the cart by clicking the 'Add to cart' buttons in the product table. A 'View cart' success message will then appear.

This is the same default text that is used globally throughout WooCommerce, and doesn't come from WooCommerce Product Table. You can override it using a WooCommerce filter, but because it’s generic it will affect other parts of the store (e.g. after adding to the cart on the shop or category pages). If you only want to change the 'View cart' text in the product table, then you can add some checks to only use the filter on a product table page, or on any ‘page’ rather than the Shop or a Category. We have included this in the following filter, which you can tweak as necessary:

add_filter( 'wc_add_to_cart_params', function( $params ) {
// Don't modify params if we're on a WooCommerce page (delete if not needed).
if ( is_woocommerce() ) {
return $params;
}

// Set the 'View cart' text
$params['i18n_view_cart'] = 'Your text here';
// Set the 'View cart' URL
$params['cart_url'] = 'Your URL here';
return $params;
} ); (edited)

Related Articles

Still need help?
If searching the knowledge base hasn't answered your question, please contact support.