So this works in the browser (the main part of the code). But since I can't seem to be able to access the document element... what is the workaround?
import wixUsers from 'wix-users';
$w.onReady(function () {
let user = wixUsers.currentUser;
let isLoggedIn = user.loggedIn;
let matches = document.querySelectorAll('span[data-hook]');
if(isLoggedIn){
for(var i =0; i < matches.length; i++){
if(matches[i].dataset.hook === "product-item-price-to-pay"){matches[i].style.display = "inline"}
}}
if(!isLoggedIn){
for(var m =0; m < matches.length; m++){
if(matches[m].dataset.hook === "product-item-price-to-pay"){matches[m].style.display = "none"}
}}
});
This answer were not worked as expected
Wix doesn't work with HTML code, it uses Javascript.
If you want to do things like query, then use js.
https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html
Same with hooks in your datasets.
https://support.wix.com/en/article/corvid-using-data-hooks
https://www.wix.com/corvid/reference/wix-data.Hooks.html
Although, if you are talking about Wix Stores, then they have their own Wix Support pages.
https://support.wix.com/en/wix-stores/setting-up-your-store
https://support.wix.com/en/article/hiding-the-price-of-a-product-in-wix-stores
https://support.wix.com/en/corvid-by-wix/wix-stores-with-corvid