Woocommerce: Changing Add to Cart Text Not Working (3 posts)

  1. johner1
    Posted 2 years ago #

    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' );
  2. Chris Smith
    Posted 2 years ago #


    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');
  3. sumon380
    Posted 1 year ago #

    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 +

Topic Closed

This topic has been closed to new replies.

About this Topic