I am having a problem with the store breadcrumbs not showing the correct collections, so the back path is not taking you back to collection you came from but a random other collection… I am waiting for WIX support to get back to me (sigh)… I have found that if I do a screen refresh then the correct breadcrumb path will then usually show. So, I’m wondering as a quick fix that if I can find a way for a store page to force a page refresh as soon as it loads it may help as a short term fix?
I’m not a coder, but could someone point me in the right direction of a piece of code I can paste into the product page so it will fore a refresh just the once after it loads?
Thanks.
Thanks GOS, but I’m after a way of getting the page to automatically refresh just once after it loads? The examples above either do it on a timer or after an event… I’m not a coder so I’m not sure if it is possible or not?
The last link gives you options to do it as you asked.
Either when the user logs in or by adding the wixlocation to() function to your pages onReady function.
Thanks GOS. If I add wixLocation . to ( ‘wixLocation.url’ ); to the onReady won’t the page load, become ready, refresh, become ready, refresh, repeatedly?
@markhughes04
Yes you are right, the onLogin part will be suitable if you had users login on the Wix Stores page, however putting it in the onReady will just create an endless loop, my bad not enough liquid fuel for my brain 
As you are talking about the breadcrumbs on the Wix Stores pages, note that these are technically built into the Wix Stores app itself, so in theory you would probably be best suited going through Wix Support and seeing if they can pass the issue onto the Wix Stores team who can look into this further for you.
You can try having a look at the Wix Location API and the onChange function there.
https://www.wix.com/corvid/reference/wix-location.html#onChange
onChange( )
Adds an event handler that runs when an application page’s URL changes.
Description
The event handler set by the onChange function runs when the location is changed but the change doesn’t trigger navigation. This situation occurs when navigating between subitems on a page that is managed by a full-page application.
For example, a store product page is a full-page application. When a product page’s path changes because it is switching between items, no actual navigation is taking place. You can use the onChange event handler to determine when a new product is displayed and perform any necessary partial updates on the current page.
To determine if a page is managed by a full-page application, use the wix-site currentPage property or getSiteStructure() function to retrieve a StructurePage object that corresponds to the page. If the object contains an applicationId value, then the page is managed by a full-page application.
Also, take note of this page about the back button request and working with breadcrumbs in Wix, with it only working in live sites.
https://support.wix.com/en/article/request-adding-a-back-button-to-your-product-page
Yes this is possible , to do this you’re going to have to store data in the session or local. Session basically means store in current tab (session) only. Local basically means store permanently on current browser (even if the user closes all the tabs/window and come back next time the data will remain there as long as the browser hasn’t been reset/cleared)
Using session:
import {session} from 'wix-storage';
import wixLocation from 'wix-location';
$w.onReady(function () {
let loaded = session.getItem("loaded")
if (loaded === "true") {
//nothing happens
} else {
session.setItem("loaded","true")
wixLocation.to(wixLocation.url)
}
})
Using Local:
import {local} from 'wix-storage';
import wixLocation from 'wix-location';
$w.onReady(function () {
let loaded = local.getItem("loaded")
if (loaded === "true") {
//nothing happens
} else {
local.setItem("loaded","true")
wixLocation.to(wixLocation.url)
}
})
With session and local you can pass data to other tabs/pages. Very useful in some situations
DJ bon26
Ciao,
volevamo sapere se c’era un codice per aggiornare la pagina solamente una volta dopo che la pagina è stata caricata?
import wixLocation from ‘wix-location’;
$w.onReady(function () {
setTimeout(() => wixLocation.to(wixLocation.url), 5000)//TIME IN MILLISECONDS
})
Questa funzione refresha la pagina ogni 5 secondi, a noi servirebbe una volta sola.
Grazie del supporto!
PLEASE STOP OPENING AND REOPENING OLD POSTS AND CREATE SEVERAL POSTS ONTO ONE AND THE SAME ISSUE!
https://www.wix.com/velo/forum/coding-with-velo/refresh-page-one-time