Skip to main content

How to show automatically Login box on checkout page in woocommerce?

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

Popular posts from this blog

How to check date format in PHP?

Check date format in PHP function isCorrectDateFromat($date){     if(!empty($date)){         $dateString = $date; // Replace this with your date string         $format = "Y-m-d"; // Replace this with your expected date format         $dateTime = DateTime::createFromFormat($format, $dateString);         if ($dateTime === false) { /*             echo "The date is not in the correct format."; */         } else {             $errors = DateTime::getLastErrors();             if (empty($errors)) { /*                 echo "The date is in the correct format."; */                 return true;             } else { /*                 echo "...