woocommerce display link only if user is logged in javascript code example Example: detect logged user wordpress javascript document.body.classList.contains( 'logged-in' );