WordPress.org

Support

Support » Plugins and Hacks » WooCommerce » [Resolved] Woocommerce 2.1.1. change add to cart in to single product page

[Resolved] Woocommerce 2.1.1. change add to cart in to single product page

  • This was the code i used before, with the current update it doesnt function anymore..

    Please help..

    /* replace add to cart text on button */
    add_filter(‘add_to_cart_text’, ‘woo_custom_cart_button_text’);
    function woo_custom_cart_button_text() {
    return __(‘More Info’, ‘woocommerce’);
    }
    /* remove add to cart class */
    add_filter(‘add_to_cart_class’, ‘woo_custom_cart_button_class’);
    function woo_custom_cart_button_class() {
    return __(‘more_info_button’, ‘woocommerce’);
    }
    /* make all products go to product page */
    add_filter( ‘add_to_cart_url’, ‘woo_more_info_link’ );
    function woo_more_info_link( $link ) {
    global $product; // switches link in all cases, i.e. in plugins
    $link = get_permalink( $product->id );
    return $link;
    }

    https://wordpress.org/plugins/woocommerce/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Same problem here. I used:

    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’ );

    }

    After updating to 2.1.1 it displays standard text “add to cart” only. Woocommerce Poor guys swiss knife plugin cannot change the text either.

    On http://cursus.5ct.info/?post_type=product you may see what I mean; the Dutch version of “add to cart” is very long.

    The name of this filter changed. Use woocommerce_product_add_to_cart_text to change the text on the add to cart buttons and woocommerce_product_add_to_cart_url for the URL.

    Hello Coen,

    Thanks for your comment,

    The following code is what i and others are looking for, i have seen many questions on google about this topic.

    I need the “add to cart” text to change in to “view item”
    instead of adding it to the chart it needs to end up on the single product page.

    Could you past the code that we can put in to the functions.php?

    You would use it in the same way as in the code posted in your initial post in this topic, only with the new filter names as I provided in my response to that.

    Hi!

    What is the right new name for variable products?

    Hey did someone resolved this problem ? i need code which will redirect add to cart to product page i tryed to use :

    /* make all products go to product page */
    add_filter( ‘woocommerce_product_add_to_cart_url’, ‘woo_more_info_link’ );
    function woo_more_info_link( $link ) {
    global $product; // switches link in all cases, i.e. in plugins
    $link = get_permalink( $product->id );
    return $link;
    }

    but it dont work 🙁

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Woocommerce 2.1.1. change add to cart in to single product page’ is closed to new replies.
Skip to toolbar