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.