Hi there, been driving myself mad trying to create a redirect dependant on the last page visited by the viewer.
I am trying to design part of a multistage checkout process. Once a customer had added their product in a product page I would like them to be redirected to the next stage of the process.
This is what I have so far - keeps jumping through stage one into stage 2 regardless of wether view has looked at product page or not.
SITE:
import {memory} from ‘wix-storage’ ;
import wixLocation from ‘wix-location’ ;
I’ve had troubles with the wixWindow.referrer too. So I recommend trying to use this code instead on your page:
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
import {memory} from 'wix-storage';
let previousPageURL = memory.getItem("page");
if (previousPageURL === '/product-page/1-page-website') {
wixLocation.to('/copy-of-stage-1-1')
}
Hi Quin, thanks for the quick reply! Unfortunately this doesn’t seem to work either, no redirect taking place. Could there be an error in my code used on the site section?
import {memory} from ‘wix-storage’ ; import wixLocation from ‘wix-location’ ; let previousPageURL;$w.onReady( function () { previousPageURL = memory.getItem( “page” ); memory.setItem( “page” , wixLocation.url);});
The page is not redirecting as it should, no error code being shown. I have included all appropriate screenshots and codes below in an effort to make it as clear as possible, please let me know if anything else is needed
The page is not redirecting as it should, no error code is shown. I have included all appropriate screenshots and codes below in an effort to make it as clear as possible, please let me know if anything else is needed
import wixLocation from 'wix-location';
import wixWindow from 'wix-window';
import {memory} from 'wix-storage';
let previousPageURL = memory.getItem("page");
if (previousPageURL === 'https://elevatedmediadesign.com/product-page/creation') {
wixLocation.to('https://elevatedmediadesign.com/stage2')
}
It’s just a simple example, you can work on it and some much better.
For example a one-page check-out by using anchors and so on.
You can also put all the 5 Stage-Boxes over eachother (overlapping-mode) and hide/show each of the active stage.
You will not be redirected anywehere ----> no page-loadings = no waste of time.
Most of people aren’t aware of it, and don’t know how to use it, I use it all the time, it’s such a powerful tool, just if it didn’t lose the dynamic height a week ago
$w.onReady(function () { });
export function EmptyFullStateBox_viewportLeave(event) {
{$w("#EmptyFullStateBox").changeState("Maintenance");}
}
Didn’t have much luck and then wondered if there were is a coding possibility for when a specific product is added to the cart? Working on a test page here - https://www.elevatedmediadesign.com/blank
The button on stage three links to the cart page as I couldn’t figure out how to display this in the Multi-State Box.
My remaining questions are around the navigation of states. Is it possible for the states to change depending on which item was added to the cart or if the view has just come from the relevant product page?
Is it possible for the states to change depending on which item was added to the cart or if the view has just come from the relevant product page?
First at all there is a question if you use your own cart-system or the one of wix?
Do you use the app → WixStores?
If so, then you have to look, which possibilities are given to it.
When you found the value of the item which was added to the cart, you just make an if-query and ask depending on which item was selected to show the related state of the multi-state-box.