How can I create a product details button?

Not every theme may display a „Product Details“ button in the product overview, which can still be very helpful from the user’s point of view, as not everyone is aware that, for example, the product title displays the corresponding details page after clicking on it.

The following code in functions.php solves this problem:

add_action('woocommerce_after_shop_loop_item', 'add_a_custom_button', 5 );
function add_a_custom_button() {
    global $product;

    if( $product->is_type('variable') || $product->is_type('grouped') ) return;

    echo '<div style="margin-bottom:10px;">
        <a class="button custom-button" href="' . esc_attr( $product->get_permalink() ) . '">' . __('Produktdetails') . '</a>
Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.