This is a very short tutorial, In this tutorial, I will explain how to customize ‘add to cart’ text in WooCommerce which help you during you developing the WooCommerce based e-commerce websites on WordPress platform. One this really important is you free to make any change in the below as per your requirement.
Use the below code at the end of the in your Theme’s functions.php file.
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); function woo_custom_cart_button_text() { return __( 'My Button Text', 'woocommerce' ); } ?> |
Use the below code at the end of the in your Theme’s functions.php file. Below code will change the add to cart text as you want. You can change the text “My Button Text” as per your requirement.
1 2 3 4 5 6 7 8 9 10 11 12 |
<?php add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); function woo_custom_cart_button_text() { return __( 'My Button Text', 'woocommerce' ); } ?> |
If you still need any help, feel free to add your comments in below comment section. I will be happy to help. Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials and also don’t forget to subscribe my blog to get all future tutorials directly in your mail box.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: woocommerce plugin for wordpress tutorial, woocommerce plugin wordpress tutorial, woocommerce tutorial, woocommerce tutorials, wordpress tutorial, wordpress tutorial for beginner, wordpress tutorial for beginners, wordpress tutorials for beginners, wordpress woocommerce tutorial