The Blog

Change the Add to Cart text in WooCommerce

So you just finished setting up your beautiful, functional, life-changing, WooCommerce powered store, but there’s one thing missing.

It sucks.

It’s awful.

The world’s caving in and there’s no where else to turn.

Your add to cart buttons suck.

So, you want to change the text? That’s cool. I don’t blame you. Add to cart is pretty boring and might not really illustrate the action that is going on.

You want this person to get excited about giving you money right?

Let’s make it something awesome, like 'Yes! I WANT this!'. We’re now going to add some code to the functions.php file.

For the ‘single’ product page, let’s add the following:

But then what about on the ‘archive’ product pages? Add this:

Some users found that this also affected the variable products. If you only want to control the changing based on the product type, try this:

That’s all good and well, but you may want to only change this for a certain product. If so, use the following but change the 386 to the product ID of the product in question:

That will work on the single product pages, but you could just adjust it to work with the product archive code too.

You also may want to do this for multiple specific products, with unique text for each of them:

So one last thing before I run off and try enjoy my weekend. Let’s say you wanted to only change the add to cart text for products in a certain product category. Just change the 17 to be the ID of the category in mention (to find it, follow the product ID finding instructions I linked to below but for categories, not products):

Go and make some cool add to cart buttons!

All the above code snippets need to be added to either your theme’s functions.php file or through a custom PHP plugin like Functionality. Make sure to remove the opening <?php. Make sure to remove the opening <?php tag if need be.

Introducing Metorik

For

A single dashboard unifying your store's orders, customers, and products, helping you understand your data and make more informed decisions.