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”}
}}
});