For any reason, you could change the “Add to Cart” text in your single product page in WooCommerce.
Maybe you are based in UK, so it would be “Add to Basket” and you don’t want to use the plugin translation, or simply you want it to say something cool and unique.
There’s a way to change the text on all products with a filter.
Open the file functions.php located in wp-content/themes/your-theme-name/ and add this code at the end of the file:
This code will change the button text on all your products. What if you want to change it conditionally, in example, based on the product type?
There’s a little change you need in the previous code. It should be like this:
In this code we check the product type and return a different text based on that.
You can obviously add more types if you want to. For example if you use WooCommerce Photography you could add the type
Leave a Reply