Home Forums WoodMart support forum Change add to cart with view product

Change add to cart with view product

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #178836

    netart.gr
    Participant

    Hello there.
    Is it possible to disable add to cart button on product category page?
    I want user to go into product page, choose some product options and then and only then to press the “add to cart” button.

    Also, it would be great if instead of “add to cart” there was a “view product” button.
    https://imgur.com/SN95VEp

    #178870

    Hello,

    Please add this code to the Theme Settings > Custom CSS > Global:

    .product-grid-item .woodmart-add-btn{
      display:none;
    } 

    Best Regards

    #178931

    netart.gr
    Participant

    Ok, any way to replace “add to cart” button on category page with “view product” button?

    I think this is a MUST and very useful feature for all us that want user to visit product page and only then be able to add to cart…

    #178943

    Hello,

    You can rewrite all theme and plugin texts via PO file in WordPress. Here is a video tutorial that should help you rewrite your website texts with a Loco Translate plugin https://www.youtube.com/watch?v=D3NsDdMzsls&list=PLMw6W4rAaOgKKv0oexGHzpWBg1imvrval&index=3

    Best Regards

    #178948

    netart.gr
    Participant

    OK, but I don’t want only text replacement. I want to change button’s url and functionality.
    ON CLICK -> GO TO PRODUCT
    NOT
    ON CLICK -> ADD TO CART

    #178966

    Hello,

    Woocommerce does not provide such an option. You will have to customize Woocommerce. Woocommerce customization is not covered by our support.

    Best Regards

    #190039

    WebKonst
    Participant

    Code goes in function.php file of your active child theme (or theme).

    // Replace add to cart button by a linked button to the product in Shop and archives pages
    add_filter( 'woocommerce_loop_add_to_cart_link', 'replace_loop_add_to_cart_button', 10, 2 );
    function replace_loop_add_to_cart_button( $button, $product  ) {
        // Not needed for variable products
        if( $product->is_type( 'variable' ) ) return $button;
    
        // Button text here
        $button_text = __( "View product", "woocommerce" );
    
        return '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>';
    }
    #190082

    Hello,

    You can try the code suggested. Please note: we have not tested and do not guarantee this code is correct. If you decide to apply, add the code to the functions.php of the child theme as it would be deleted in the nearest update of the theme if you add into functions.php of the parent theme.

    Best Regards

Viewing 8 posts - 1 through 8 (of 8 total)