I want to add active class When I select a shipping method on the checkout page.
For example: If I select free shipping then active class should be added on radio button which is free shipping.
Thanks in advance.
You can add below JS code in your checkout page for your requirement.
<script>
require([
'jquery'
], function ($) {
$(document).ready(function () {
$("body").on("click", "#checkout-shipping-method-load .col-method .radio", function(){
$("#checkout-shipping-method-load .col-method .radio").removeClass("active");
if($(this).attr("checked") == "checked") {
$(this).addClass("active");
}
});
});
});
</script>
Flush the cache after the changes.
Hope it helps!!!