Quantcast
Channel: XTemos » All Posts
Viewing all articles
Browse latest Browse all 38962

Replace “Add to Cart” / category loop

$
0
0

Hi xtemos,

How can I replace “Add to Cart” button in category loop list with a link-button to single product page in woo commerce? So far I have the following code which removes the add to chart button and replaces it – but do_shortcode is not executed and all I get, is plain

[button link=”http://mobiflora.de/shop/geburtstag/blumeideal-blumenstrau-chic/”]Read more[/button]

Any Ideas or snippets?

Thank you so much

Till

function remove_loop_button(){
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10 );
}
add_action(‘init’,’remove_loop_button’);

/*STEP 2 -ADD NEW BUTTON THAT LINKS TO PRODUCT PAGE FOR EACH PRODUCT */

add_action(‘woocommerce_after_shop_loop_item’,’replace_add_to_cart’);
function replace_add_to_cart() {
global $product;
$link = $product->get_permalink();
echo do_shortcode(‘<br>[button link=”‘ . esc_attr($link) . ‘”]Read more[/button]’);
}

Private Content Hidden

Viewing all articles
Browse latest Browse all 38962

Trending Articles