If user is not login in woocommerce on checkout page then checkout login option will automatically enable to login.
Login with checkout page login option in woocommerce
function show_login_option(){
$slug = basename(get_permalink());
if($slug=='checkout'){
if ( is_user_logged_in() ) {
// echo '<script>alert("your are login");</script>';
} else {
?>
<script>
jQuery(document).ready(function($) {
$(window).load(function() {
$('.showlogin').click();
//alert('hello');
});
});
</script>
<?php
}
}
}
add_action('wp_head','show_login_option');
Comments
Post a Comment