Created
August 14, 2020 15:02
-
-
Save be-mohand/7dea38613e484eaf0cd1fa02a2036d65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
// Apply only on product page | |
// If the user is not logged in, we hide the price and the purchase btn, and we display a login btn | |
if($('.listing-show').length > 0 && Kr.AuthenticatedUser === null) { | |
$('.listing_details_list .price').remove(); | |
$('.add-to-cart-panel').empty(); | |
// Create a login Button | |
var loginBtn = document.createElement('a'); | |
loginBtn.href = '/login'; | |
loginBtn.innerHTML = 'Login'; | |
loginBtn.className = "btn btn-primary full-width"; | |
$('.add-to-cart-panel').append(loginBtn); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment