• I upgraded to Woocommerce to 2.1 this past week and everything is functioning normally with one exception. I had added a filter to functions.php in my child theme to change the Add to Cart button text from “Add to Cart” to “Give”. This seems to no longer be working after the upgrade.

    Code included below. Any help is greatly appreciated. Have been racking my brain trying to figure out what happened. One final note: I would prefer not to use the translation workaround if I can avoid it.

    // Filter to change "Add to Cart" text to "Give"
    add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // < 2.1
    add_filter( 'single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
    
    function woo_custom_cart_button_text() {
    return __( 'Give', 'woocommerce' );
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • johner1,

    any chance you got this resolved?

    I have a similar issue with my button text and filters not working. My code is posted below:

    add_filter('variable_add_to_cart_text', 'woo_custom_cart_button_text');
    	add_filter('_add_to_cart_text', 'woo_custom_cart_button_text');
    	add_filter('single_add_to_cart_text', 'woo_custom_cart_button_text');
    
    	function woo_custom_cart_button_text() {
    
    	return __('Select', 'woocommerce');
    
    	}

    If you are using woocommerce 2.1+ then try the below filter.

    add_filter( ‘woocommerce_product_add_to_cart_text’, ‘woo_custom_cart_button_text’ ); // 2.1 +

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce: Changing Add to Cart Text Not Working’ is closed to new replies.