Skip to content

Instantly share code, notes, and snippets.

@emre-edu-tech
Last active October 13, 2024 07:03
Show Gist options
  • Select an option

  • Save emre-edu-tech/5f1eefba8e3e16e01ef91d0251e5546d to your computer and use it in GitHub Desktop.

Select an option

Save emre-edu-tech/5f1eefba8e3e16e01ef91d0251e5546d to your computer and use it in GitHub Desktop.
Change add to cart button to custom button on Product Archive Page
<?php
// Wooconmmerce - Change add to cart button to custom button on product archive page
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 = __("Produkt Details", "textdomain");
$button = '<a class="button" href="' . $product->get_permalink() . '">' . $button_text . '</a>';
return $button;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment