Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1409373

    Tim
    Participant

    Hi X,

    I have two questions:

    1. How do I remove the second ‘read more’ button in the category pages (https://www.tentusscher.nl/webshop/) You see one when hovering and one beneath. The one beneath needs to be removed.
    2. How do I change the text of only the read more button when hovering the product?

    Thanks!

    #1409585

    Paul R
    Moderator

    Hi,

    1. Add this in Custom > Edit Global CSS in the customizer

    
    .archive li.product > .button.product_type_simple.ajax_add_to_cart {
        display:none;
    }
    

    2. Add this in your child theme’s functions.php

    
    
    add_filter( 'woocommerce_product_add_to_cart_text', 'woo_archive_custom_cart_button_text' );    // 2.1 +
     
    function woo_archive_custom_cart_button_text() {
     
            return __( 'My Button Text', 'woocommerce' );
     
    }
    

    Hope that helps.

    #1409595

    Tim
    Participant

    Hi Paul,

    Number 1 works fine.
    Number 2 also changes the normal ‘ad to cart’ text..

    Any idea?

    Thanks

    #1409610

    Tim
    Participant

    Also a suggestion,

    Is it possible to change all the hover buttons with the same function. The function should be the same as the one which are out of stock (just a link to the product).

    So with above code we have changed the text for all buttons, which is fine. But can we also link them all to the single product page (instead of add to cart)?

    Thanks!

    #1410185

    Rad
    Moderator

    Hi there,

    Please check this doc, https://docs.woocommerce.com/document/change-add-to-cart-button-text/

    Please try the last code with every text for every button type.

    I checked it and it’s already linking to the product, and I think it’s Woocommerce setting that you could change.

    Thanks!

    #1417394

    Tim
    Participant

    Hi Rad,

    I am almost there. I have added this code to get a ‘view product’ button everywhere that opens the single product.

    // Change the add to cart button INTO View Product button
    // =================================================================================================================
    
    add_filter( 'woocommerce_loop_add_to_cart_link', 'add_product_link' );
    function add_product_link( $link ) {
        global $product;
        echo '<a href="'.$product->get_permalink( $product->id ).'" class="button">' . __('View Product', 'woocommerce') . '</a>';
    }

    Everything fine, except the css we used before to hide the second ‘view product’ in the category archives is back again.

    .archive li.product > .button.product_type_simple.ajax_add_to_cart {
        display:none;
    }

    I have tried the important tag but this does not help. Any suggestion?

    https://www.tentusscher.nl/product-categorie/webshop/

    Thanks so far:)

    Cheers!

    #1417405

    Tim
    Participant

    Hi Rad,

    I have written this css and it works:

    .woocommerce ul.products .button {
        display:none;
    }

    Not entirely sure if this is the best way though:)

    #1417475

    Darshana
    Moderator

    Hi there,

    There are no hard & fast rules. You can use a solution that fits your need.

    Thanks!