From 2cdb4361e475e06d1c83df0b2c86f80d2b664090 Mon Sep 17 00:00:00 2001 From: Andrew Benbow Date: Wed, 22 Jun 2016 10:37:36 +0100 Subject: [PATCH] Update tokenization-form.js When the checkout form is loaded for guests the save card option is shown, this fix hides it until the Create Account checkbox is checked. --- assets/js/frontend/tokenization-form.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/assets/js/frontend/tokenization-form.js b/assets/js/frontend/tokenization-form.js index 6fbd4d82f23..d06439118df 100644 --- a/assets/js/frontend/tokenization-form.js +++ b/assets/js/frontend/tokenization-form.js @@ -37,6 +37,13 @@ // Trigger change event $( ':input.woocommerce-SavedPaymentMethods-tokenInput:checked', $target ).trigger( 'change' ); + + // Hide "save card" if "Create Account" is not checked. + // Check that the field is shown in the form - some plugins and force create account hide it + if( !$('input#createaccount').is(':checked') && $( 'input#createaccount' ).length > 0) { + $( '.woocommerce-SavedPaymentMethods-saveNew', $formWrap ).hide(); + } + }; this.hideForm = function() {