Skip to content

Commit 6b8844e

Browse files
committed
Implement a way of tracking which payment method hid the Save and Continue button, allowing other libraries to use the same method of hiding the button.
1 parent ac1c66b commit 6b8844e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/assets/javascripts/spree/frontend/spree_paypal_express.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ SpreePaypalExpress = {
1717
},
1818
hideSaveAndContinue: function() {
1919
$("#checkout_form_payment [data-hook=buttons]").hide();
20+
$("#checkout_form_payment").data('hidden-by-payment-method-id', SpreePaypalExpress.paymentMethodID);
2021
},
2122
showSaveAndContinue: function() {
22-
$("#checkout_form_payment [data-hook=buttons]").show();
23+
if (typeof ($("#checkout_form_payment").data('hidden-by-payment-method-id')) === 'undefined' || $("#checkout_form_payment").data('hidden-by-payment-method-id') == SpreePaypalExpress.paymentMethodID) {
24+
$("#checkout_form_payment [data-hook=buttons]").show();
25+
$("#checkout_form_payment").removeData('hidden-by-payment-method-id');
26+
}
2327
}
2428
}
2529

0 commit comments

Comments
 (0)