Home Forums WoodMart support forum Change and redirect add to cart button

Change and redirect add to cart button

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #89432

    ccpeter
    Participant

    Hi,

    I want to redirect the add to the cart button to the product detail page.

    I am using this code

    add_filter( ‘woocommerce_loop_add_to_cart_link’, ‘replacing_add_to_cart_button’, 10, 2 );
    function replacing_add_to_cart_button( $button, $product ) {
    $button_text = __(“Info/Bestellen”, “woocommerce”);
    $button = ‘get_permalink() . ‘”>’ . $button_text . ‘‘;

    return $button;
    }

    However, the button disappears. I am using “Show summary on hover’

    How can i fix this? And is (and how ;)) it possible to place in the summary only the SKU.

    Many thanks. Peter

    #89442

    Hello,

    Thank you very much for choosing our theme and for contacting us.

    Please add this snippet to the fundtions.php of the child theme:

    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10);
    add_filter( 'woocommerce_after_shop_loop_item', 'replacing_add_to_cart_button', 10 );
    
    function replacing_add_to_cart_button() {
    	echo '<a href="' . get_permalink() . '" class="button product_type_simple add_to_cart_button add-to-cart-loop" rel="nofollow"><span>Info/Bestellen</span></a>';
    }

    Best Regards

    #89455

    ccpeter
    Participant

    Thank you Elise 🙂

    #89479

    Hello,

    No, It is not possible with CSS. It will require more complicated customization not covered by our support and we do not have a quick solution.

    Best Regards

Tagged: 

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