Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
- <script>
- Ecwid.paymentOptionElement = function(caption) {
- return jQuery("label:contains('" + caption + "')").parents('.ecwid-PaymentMethodsBlock-PaymentOption');
- };
- Ecwid.OnPageLoaded.add(function(page) {
- if (page.type === 'CHECKOUT_PAYMENT_DETAILS') {
- Ecwid.Cart.get(function(cart) {
- //if customer selects 'Abholung' shipping method
- if (cart.shippingMethod === 'Abholung') {
- //then hide 'Vorauszahlung' payment method
- Ecwid.paymentOptionElement('Vorauszahlung').hide();
- } else {
- //if customer selects any other shipping method, hide 'Barzahlung' payment method
- Ecwid.paymentOptionElement('Barzahlung').hide();
- }
- if (jQuery('.ecwid-PaymentMethodsBlock-PaymentOption:visible input:checked').length === 0) {
- jQuery('.ecwid-PaymentMethodsBlock-PaymentOption:visible:first input')[0].click();
- }
- });
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement