Support » Plugin: WooCommerce » See Details Button instead of “Add to Cart”

  • Resolved trixox

    (@trixox)


    Hi,

    how can I make sure that I can change “Add To Cart” Button to “See details”? It should lead to the single product page then. And just then the customer should have the opportunity to click” Add To Cart” Button.

    So I need this to get changed on the /shop page and also on the WooCommerce Product Widgets

    Bests

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support m155y5

    (@m155y5)

    Automattic Happiness Engineer

    Hi @trixox – this code should do that on the shop or category pages for you:

    /* Remove add to cart button */
    add_action('woocommerce_before_shop_loop_item','remove_loop_add_to_cart_button'); 
    function remove_loop_add_to_cart_button(){
        global $product; // Current product
        remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 ); 
    }
    /* Add see details button to replace add to cart button*/
    add_action('woocommerce_after_shop_loop_item','replace_add_to_cart_with_view_product'); 
    function replace_add_to_cart_with_view_product() {
        global $product;
        $link = get_permalink(); 
        echo '<a class="button" href="' . esc_attr($link) . '">See Details</a>';
    }

    As far as replacing the button for the pages generated using WooCommerce Blocks, I’m afraid that is not currently customizable (more on that here).

    Plugin Support m155y5

    (@m155y5)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to go ahead and mark this thread as resolved. If you have any other questions please feel free to start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.