I've made a back link to take customer from single product back to product display. I need to know how to give this code a class to make it a button.
The code is
add_action( 'woocommerce_after_add_to_cart_button', 'back_button', 10 );
function back_button() {
global $product;
echo ' <a href="javascript:history.go(-1)">Go Back to selection</a> ';
Thanks
I tried putting
add_action( 'woocommerce_after_add_to_cart_button', 'back_button', 10 );
function back_button() {
global $product;
echo ' <button><a href="javascript:history.go(-1)">Go Back to selection</a></button> ';
}
In answer to my own question, even though it's not really what I was after but it does the job. I got Wordpress Back button widget plugin. It lets you add “Back” button to your website.
The button can be added via widget, [alg_back_button] shortcode or echo alg_back_button( 'Back' ); function. So until I learn more, this will do. I hope this will help someone else :)