Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter lange420

    (@lange420)

    Hey, thanks for the reply.

    I manage to sort out the problem using the following scripts.

    Blessings

    /**
    * @snippet Change WooCommerce ‘Add to Cart’ button to 'View Product'
    * @source https://www.wptechnic.com/?p=4615
    * @author Muhammad Tamzid
    * @compatible WC 4.3.1
    */
    // Change WooCommerce 'Add To Cart' button to 'View Product'
    add_filter( 'woocommerce_loop_add_to_cart_link', 'wpt_custom_view_product_button', 10, 2 );
    function wpt_custom_view_product_button( $button, $product  ) {
    // Ignore for variable products
    if( $product->is_type( 'variable' ) ) return $button;
    // Button text here
    $button_text = __( "View product", "woocommerce" );
        return '<a class="button wpt-custom-view-product-button" href="' . $product->get_permalink() . '">' . $button_text . '</a>';
    }
Viewing 1 replies (of 1 total)