WooCommerce Archive – add 'View Details' button problem

This topic has 2 replies, 2 voices, and was last updated 9 years, 4 months ago ago by Jack Richardson

  • Avatar: s303ds
    s303ds
    Participant
    July 10, 2015 at 11:23

    Dear Support,

    I use the Royal theme, and I need some help.
    The url: http://www.hazimozistudio.hu

    I’d like to add “view details” button next to the add to cart button for every product excerpt listed on the archive posts pages (where users browse the content of a category), to enable users to get to the single product page by clicking it.
    http://www.hazimozistudio.hu/termekkategoria/hazimozi-projektor-kepmegjelenites/

    If I edit archive-products.php adding a <button>, I can achieve some success, but it doesn’t work properly, and I realized that it might not be the solution. Because I saw all the added <button> at once one after another. I should rather use the hook method.

    I wrote some code I paste here, I would like you to please help with some questions about it:
    1. Does it seem correct?
    2. Where do I have to put it (which file) because editing functions.php makes an instant crash of the site.

    The code I wrote:

    add_action( ‘woocommerce_after_add_to_cart_button’, ‘add_content_after addtocart_button_func’ );

    function add_content_after addtocart_button_func() {

    echo ‘<button onclick=”location.href='<?php echo get_permalink( $loop->post->ID ) ?>'” type=”button” class=”details btn btn-default btn-lg”>View details</button>’;

    }

    Thank you in advance,
    Attila

    Please, contact administrator
    for this information.
    1 Answer
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    July 11, 2015 at 07:23

    Hello,

    We recommend you to contact Woocommerce support as products pages are their configuration and they can suggest you what code to add to achieve what you want.

    Best regards,
    Jack Richardson.

  • Viewing 2 results - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.