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.
This commit is contained in:
Andrew Benbow 2016-06-22 10:37:36 +01:00 committed by GitHub
parent 1ea3ffb5a8
commit 2cdb4361e4
1 changed files with 7 additions and 0 deletions

View File

@ -37,6 +37,13 @@
// Trigger change event // Trigger change event
$( ':input.woocommerce-SavedPaymentMethods-tokenInput:checked', $target ).trigger( 'change' ); $( ':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() { this.hideForm = function() {