Hello,
I'm using Toolset with WC and have several cred form in the same apge. This means that users can order different products. So, all my creds are linked to a WC product and as soon as a cred is validated, the user is redirected to the cart.
I would like to add a button in the cart in order to gaive opportunity to the users to go back to the previews page in order to be able to continue shopping.
What do I need to use for the link of this specific button (to be placed in the WC template).
Regards
Pat
Dear Pat,
Could you describe the question with more details?
What is the preview page? is it woocommerce shop page?
Are you going to setup the link in woocommerce PHP template file?
Hello Luo,
I want to add a new button in the WC cart with the link to the previews page (the page where I have the different CREDs in) in order for the users to be able to come back quickly to this previews page if they have other products to buy.
Regards
Pat
I assume the preview page is a wordpress page, and you are going to setup the link in the wocommerce template file, I suggest you check the template file of Woocommerce plugin:
\woocommerce\templates\cart\cart.php
In this theme file, setup a link to the preview page, you can use wordpress function get_permalink() to get the page link:
https://developer.wordpress.org/reference/functions/get_permalink/
Hi Luo,
It's partially OK, but I'm not able to retreive the previous page visited. The permalink function gives you the current page, but not the previous one.
Any idea?
Thanks
Pat
I am not sure what is the previous page you mentioned above, but you can use Javascript to setup a link to redirect user to the previous page, see similar thread:
http://stackoverflow.com/questions/9756159/using-javascript-how-to-create-a-go-back-link-that-takes-the-user-to-a-link-i
Hi Luo,
I have found the way to go back to previews page with this link :
<a href="<?php echo (wp_get_referer()) ?>" class="btn btn-primary">RETOUR PAGE PRECEDENTE</a>
Regads
Pat