I have two landing pages In each of them different products to purchase .
When the customer reaches the cart page Continue shopping button
Directs him to the main page of the site .( That’s not what I need)
that why I need to add a button that will return him to the page he came from.
thanks
How do I get the referral ?
I tried some code I found here but it does not work
import wixLocation from ‘wix-location’;
import wixWindow from ‘wix-window’;
export function backbutton1_click(event, $w) {
let url = wixWindow.referrer
wixLocation.to(url)
}
When visitors move from page to page within your site, the referrer property does not contain the address of the page the visitor came from. This is because Wix sites are built as single page applications . To get the previous page a visitor was visiting within your site, you can use wix-storage to store the visitor’s current page and retrieve the visitor’s previous page.
Here is a very simple example of a “back button” site:
Hi I am a complete noob and I am wanting to add a Back button like this on the Product Page so it takes the user back to previous store page they were on. How would i even go about making this button with the proper code for it?
Hey for some reason this code stopped working for me. Did something get deprecated? There is other code involved in the section but it shouldn’t be interfering. If I put this in masterPage.js it shows #backbutton in red. I don’t have backbutton in all pages only some of them. Thanks!
import { cart } from ‘wix-stores’ ; import { formFactor } from ‘wix-window’ ; import wixData from ‘wix-data’ ;
import wixWindow from ‘wix-window’ ;
import { session } from ‘wix-storage’ ; import wixLocation from ‘wix-location’ ;
let previousPageURL ; let productID ; let productPrice ; let originalprice = 0 ; let neworgprice = 0 ;
Hello! For anyone struggling with this, make sure you put the code that Impact Designs posted into the masterPage.js file. Then insert a button into whichever page you want to have a back button. Set the button’s ID to “btnBack”. Enjoy!
Hi! I copies this code into the masterPage.js file and added the button ID. But when I try the button on site, it doesn’t link anywhere. What am I possibly doing wrong?