1. Home
  2. Knowledge Base
  3. WooCommerce Product Table
  4. Advanced Usage

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

Please note: this article is aimed at developers. We have provided an article on how to add code snippets. If you're not comfortable using them then you can use our plugin customization service.

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.
    if ( is_woocommerce() ) {
        return $params;
    }

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

Related Articles

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