Last active
December 6, 2020 15:45
-
-
Save aatronco/2811c453256eb97f73d5607acd2e0ea6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var payment_method_id = '289171'; | |
var shipping_method_id = '258168'; | |
function cashOnDelivery(){ | |
if($("#payments_options input:checked").val() == payment_method_id){ | |
$.each($('#shipping_options input'), function(index, element){ | |
element = $(element) | |
if(element.val() != shipping_method_id){ | |
element.parent().hide() | |
}else{ | |
element.parent().show() | |
$('#shipping_options input[value='+shipping_method_id+']').click(); | |
} | |
} ) | |
}else{ | |
$.each($('#shipping_options input'), function(index, element){ | |
element = $(element) | |
if(element.val() != shipping_method_id){ | |
element.parent().show() | |
$('#shipping_options input[value='+$(this).val()+']').click(); | |
}else{ | |
element.parent().hide() | |
} | |
} ) | |
} | |
}; | |
$(document).ready(cashOnDelivery); | |
$("#payments_options").click(cashOnDelivery); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
instead of 112994 it's more clear to have:
var payment_method_id = '112994'
and later replace that with a Theme Option.