Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Add to cart, link to product page

// First, remove Add to Cart Button
add_action( 'after_setup_theme', 'my_remove_add_to_cart', 99 );
function my_remove_add_to_cart() {
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );    
}

// Second, add View Product Button
add_action( 'woocommerce_after_shop_loop_item', 'bbloomer_view_product_button', 10 );
function bbloomer_view_product_button() {
    global $product;
    $link = $product->get_permalink();
    echo '<a href="' . $link . '" class="button addtocartbutton">View Product</a>';
}
Source by wordpress.org #
 
PREVIOUS NEXT
Tagged: #Add #link #product #page
ADD COMMENT
Topic
Name
6+3 =