wixLocation.hash returns hash value but issue is intermittent. Sometimes it returns hash value and sometimes it fails.
Same issue here. I’ve tried wixLocation.url and wixLocation.hash and neither of them have been successful.
Don’t use hash, one reason why Wix have not kept it in their API Reference.
You should have a good read of these pages here.
https://support.google.com/richmedia/answer/190941?hl=en
https://www.oho.com/blog/explained-60-seconds-hash-symbols-urls-and-seo
Nowadays you would be much better using query or queryParams as shown here instead.
https://www.wix.com/corvid/reference/wix-location.html#query
https://www.wix.com/corvid/reference/wix-location.html#queryParams
Have a look at this previous forum post for a good quick code example.
https://www.wix.com/corvid/forum/community-discussion/parse-url-to-get-a-parameter
Basically now the hash is used with Wix Location just to go to a certain part of the page as it was always intended to do.
https://www.wix.com/corvid/reference/wix-location.html#to
Navigate to a local link and scroll to an element
This example assumes you have a page named Long Page that has an element with the ID downUnder.
import wixLocation from 'wix-location';
// ...
wixLocation.to("/long-page#downUnder");