How to change “Add to cart” button text in your WooCommerce shop

by Sep 7, 2020Focus On, Projects, Wordpress0 comments

Do you need to change the default “Add to cart” button text in your WooCommerce shop? This easy code let you change the text to “Buy”, “Add to Bag”, “Book Now”, or whatever custom text you like.

Open your WordPress panel, go to

Appearance > Theme Editor

Open functions.php theme file and add the following code at the bottom of function.php file.

Save and enjoy your new button!

// To change add to cart text on single product page
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woocommerce_custom_single_add_to_cart_text' );
function woocommerce_custom_single_add_to_cart_text() {
return __( 'Buy', 'woocommerce' );
}
// To change add to cart text on product archives(Collection) page
add_filter( 'woocommerce_product_add_to_cart_text', 'woocommerce_custom_product_add_to_cart_text' );
function woocommerce_custom_product_add_to_cart_text() {
return __( 'Buy', 'woocommerce' );
}