• Resolved 3001web

    (@2001web)


    I have set a password field for the product as I am asking for login details to the website of the client.

    For input it is correct but hen I click view cart the password is showing in plain text that is not good.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author ThemeHigh

    (@themehigh)

    Unfortunately, there is no direct option available inorder to achieve your requirement.

    However, you can achieve your requirement by adding the below code in your child theme’s functions.php.

    add_action('wp_footer', 'th3ed45_footer_frontend_action', 999);
    function th3ed45_footer_frontend_action(){
    	?>
    	<script>
    		(function($){
    			
    			var field_label = 'field_label'; // Update your field label
    			
    			var field_label = field_label.replace(/\s+/g,"");
    			var target = 'dl.variation dd.variation-'+ field_label + ' p';
    			
    			$(document.body).on('wc_fragments_refreshed', function(){
    				$(target).each(function(){
    					var f_value = $(this).text();
    					var password = f_value.replace(/./g, '*');
    					$(this).html( "<p>"+password+"</p>" );					
    				});
    			});			
    						
    			$(document).ready(function(){
    				$(target).each(function(){
    					var f_value = $(this).text();
    					var password = f_value.replace(/./g, '*');
    					$(this).html( "<p>"+password+"</p>" );					
    				});
    			});
    			
    			$(document).on('updated_checkout', function(){
    				$(target).each(function(){
    					var f_value = $(this).text();
    					var password = f_value.replace(/./g, '*');
    					$(this).html( "<p>"+password+"</p>" );					
    				});
    			});			
    		
    		})(jQuery);		
    	</script>
    	<?php
    }
    

    The code snippet is pure javascript and you need to update field_label in the above code with your password field label.

    We hope this will help.

    Thank you!

Viewing 1 replies (of 1 total)
  • The topic ‘Password showing in cart??’ is closed to new replies.