How To Change The Default Add To Cart Text In WooCommerce

Last Updated on 6th December 2019
Table of Contents

WooCommerce provides many options for customising and styling your site. Depending on the theme or page builder you integrate with WooCommerce, may have control over the content displayed in the Add To Basket or Add To Cart button.

However if for example you are using WooCommerce with Elementor, you won’t have the ability edit the Add To Basket text, instead you will have to use a PHP snippet to do this.

Changing the add to basket text

To alter your add to basket text, first ensure that you have a child theme setup on your website, as you will need to access the functions.php file of your child theme.

Navigate to Appearance > Theme Editor and access the functions.php file.

To change the default WooCommerce add to cart text, you can use a PHP snippet targeting the ‘woocommerce_product_single_add_to_cart_text’ filter. Simply pass a function to the filter as the second parameter and alter the text within your function using a return statement.

Provided below is an example snippet you can use to do this on your site.

Line 3 which reads ‘Add to the basket’ is the text you can alter as necessary. Ensure that you keep the formatting or the code will not work.

WooCommerce change default add to cart text