This topic has 2 replies, 2 voices, and was last updated 9 years, 4 months ago ago by Jack Richardson
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
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.
Tagged: archive, button, problem, themes, view details, woocommerce, wordpress
You must be logged in to reply to this topic.Log in/Sign up