Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save be-mohand/7dea38613e484eaf0cd1fa02a2036d65 to your computer and use it in GitHub Desktop.
Save be-mohand/7dea38613e484eaf0cd1fa02a2036d65 to your computer and use it in GitHub Desktop.
$(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