<commit_before>$( document ).ready(function() {
    var display = getPrice();
    $("#shipping-price").html(display);
});

$("#add_new").click(function(event) {
    event.preventDefault();
    var state = $("#new_address").css('display');
    if (state == 'none') {
        $("#new_address").show();
    } else {
        $("#new_address").hide();
    }
});

$("#shipping_method").change(function() {
    var display = getPrice();
    $("#shipping-price").html(display);
});

function getPrice()
{
    var weight = $("#cart-weight").val();

    // set weight min 1000
    if (weight < 1000) {
        weight = 1000;
    }

    // get unit price
    var id = $("#shipping_method").val() + '_price';
    var val = $("#" + id).val();

    var total = val.replace(/[^0-9\.]+/g,"") * weight / 1000;

    return val.replace(/[0-9\.]+/g,"") +  total.toFixed(2) ;
}


<commit_msg>change price display on checkout page<commit_after>$( document ).ready(function() {
    display();
});

$("#add_new").click(function(event) {
    event.preventDefault();
    var state = $("#new_address").css('display');
    if (state == 'none') {
        $("#new_address").show();
    } else {
        $("#new_address").hide();
    }
});

$("#shipping_method").change(function() {
    display();
});

function getShippingPrice()
{
    var weight = $("#cart-weight").val();

    // set weight min 1000
    if (weight < 1000) {
        weight = 1000;
    }

    // get unit price
    var id = $("#shipping_method").val() + '_price';
    var val = $("#" + id).val();

    var total = val.replace(/[^0-9\.]+/g,"") * weight / 1000;

    return total.toFixed(2);
}

function getSubtotal()
{
    return $("#subtotal").html().replace(/[^0-9\.]+/g,"");
}

function getPrice(price)
{
    // get currency
    var id = $("#shipping_method").val() + '_price';
    var val = $("#" + id).val();

    return val.replace(/[0-9\.]+/g,"") +  price;
}

function display()
{
    var shipping = getShippingPrice();
    var subtotal = getSubtotal();
    var total = parseFloat(shipping) + parseFloat(subtotal);

    $("#shipping-price").html(getPrice(shipping));
    $("#total-price").html(getPrice(total));
}



{'fraction_non_alphanumeric': 0.23287037037037037, 'fraction_numerical': 0.020370370370370372, 'mean_word_length': 2.957875457875458, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5417710', 'n_tokens_mistral': 748, 'n_tokens_neox': 707, 'n_words': 140}