Change the add to cart text on Woocommerce

/**
 * Change the add to cart text on single product pages
 */
function woo_custom_cart_button_text() {
	return __('My Button Text', 'woocommerce');
}
add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text');

/**
 * Change the add to cart text on product archives
 */
function woo_archive_custom_cart_button_text() {
	return __( 'My Button Text', 'woocommerce' );
}
add_filter( 'add_to_cart_text', 'woo_archive_custom_cart_button_text' );
  • PauloSa

    what if i want to put a variable that the user puts thru the backend … i have the variable but when i replace the ‘My Button Text’ for the $my_variable .. nothing comes up .. i have echo the variable just to check and yep the content is there .. is there a work around this ?