In this post I’ll describe how you can change the default texts of the ‘Add to cart’ buttons using a code snippet. This includes the different variations of the buttons/texts for simple, variable and grouped products on both the archive pages and the product detail page.

Default Add to Cart Button Texts

Lets start by reviewing the default buttons texts of the different product types and states. The most common ones are for simple and variable product that have a “Add to cart” and “Select options” accordingly. For grouped products its “View products”.

At times you may also see a “Read more” button, those usually appear for out of stock products or when a product doesn’t have a price assigned to it.

Changing the Add to Cart Button Texts

Using a simple code snippet you can change the ‘Add to Cart’ button texts of the above products to something else.

Changing the Add to Cart Text on the Archives

In the code snippet below it changes the text of the simple, variable and grouped ‘Add to Cart’ buttons on the shop / archive pages.

Add to Cart Text on the Product Page

Changing the text of the ‘Add to Cart’ button on the product page is actually a bit simpler. This is because the default text for all product types is the same “Add to cart”. The snippet below changes that to a “Add to basket” text.

If you’d like to change it a bit more per product type, category, or shipping class for example you can add some conditional statements like so;

To setup a custom text per category you can replicate the code in the snippet and change it accordingly for the categories that you’d like.

About the author: Jeroen Sormani is actively building WordPress, WooCommerce and Easy Digital Downloads plugins. Slightly obsessed by writing high quality code.
Follow Jeroen on Twitter

2 comments

  1. WAUW, I finally made it to work using your code! I’m an absolute noob when it comes to coding. I’m teaching myself some HTML and PHP, but this stuff still goes way over my head. I now managed to change my ‘Add to Cart’ button text for a specific category! That is huge. Thanks so much..

    One small comment: I think there is a slight typo in the statement ‘ace_custom_change_singe_add_to_cart_text’ (as a dyslectic I know how annoying this can be). Plus I’m not sure if it really matters, though!

Leave a Reply

Your email address will not be published. Required fields are marked *