• Resolved drog1998

    (@drog1998)


    Hello,

    could somebody tell me how I can change the ‘Add to cart’ button on a Woocommerce product category page to click through to the actual products details instead.

    Thanks.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Add the following to your functions.php file.

    add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );                                // < 2.1
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );    // 2.1 +
    
    function woo_custom_cart_button_text() {
    
            return __( 'My Button Text', 'woocommerce' );
    
    }

    Thread Starter drog1998

    (@drog1998)

    Hi thanks for your answer but it wasn’t what I was after.

    I want to change the buttons on this page and the other categories pages to ‘More Details’ and once clicked it go through to the actual product details.

    Thanks.

    Hi it can be done.. you need to [link moderated – do not solicit work in these forums] some one.. for this. this requires some customization , as i see you are using karma-responsive-wordpress-theme

    Thread Starter drog1998

    (@drog1998)

    ok thanks.

    Thread Starter drog1998

    (@drog1998)

    For anybody else needing the answer here it is:

    //Button
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    add_action( 'woocommerce_after_shop_loop_item', 'my_woocommerce_template_loop_add_to_cart', 10 );
    
    function my_woocommerce_template_loop_add_to_cart() {
        global $product;
        echo '<form action="' . esc_url( $product->get_permalink( $product->id ) ) . '" method="get">
                <button type="submit" class="single_add_to_cart_button button alt">' . __('More Detail', 'woocommerce') . '</button>
              </form>';
    }
    Thread Starter drog1998

    (@drog1998)

    Hi Kevin,

    i think it was the functions.php file in woocommerce plugin folder.

    Make a back up before you try it though.

    never.. never edit a plugin’s file directly from the plugins folder.
    you have to add that code in your THEMES’ functions.php file.

    Nick

    (@weeaboodesu)

    Is it possible to change the link on shop pages of product thumbnail images to link directly to the add to cart (or in my case an affiliated site) instead of the shop page??

    Any help on this would be great!!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Woocommerce] Change add to cart button on product page’ is closed to new replies.