How to change add to cart text in woocommerce
For Single product page
Add this below code to your theme functions.php file
//for < 2.1
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
// for 2.1 +
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' );
}
For Product Category Page
Add this below code to your functions.php file
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // for < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // for 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
Add this below code to your theme functions.php file
//for < 2.1
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
// for 2.1 +
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' );
}
For Product Category Page
Add this below code to your functions.php file
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // for < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // for 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}