• Is there a way to disable ‘Check Pincode’ functionality on the product page? It doesnt work all the time so want to remove it completely.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Kalpesh,
    to disable pincode serviceability on product page please go to plugin settings and uncheck Real-time Rates checkbox.
    For more information please check the help doc here:
    https://support.shiprocket.in/support/solutions/articles/43000526636-shiprocket-wordpress-app-help-document

    Thread Starter patelkalpesh

    (@patelkalpesh)

    Hi Prabhat,
    Unchecking the box disables everything (product page/cart page/chaeckout page). I just want to disable functionality on the product page.

    Howcto disable the check puncode functionality

    REMOVE THIS BELOW CODE FROM wp-content/plugins/shiprocket/shiprocket-woocommerce-shipping-calculator.php

    LINE NO: 223

    add_action(‘woocommerce_single_product_summary’, ‘shiprocket_show_check_pincode’, 20);

    /**
    * Show an option to check serviceability to a pincode
    *
    * @return null
    */
    function Shiprocket_Show_Check_pincode()
    {

    global $product;

    $settings = get_option(‘woocommerce_shiprocket_woocommerce_shipping_settings’);

    if (!isset($settings[‘integration_id’])) {
    return true;
    }

    ?>
    <div>
    <input type=”text” id=”shiprocket_pincode_check” name=”shiprocket_pincode_check” value=”” placeholder=”Enter Pincode”>

    <button id=”check_pincode” onClick=”checkPincode()”> Check Pincode </button>
    </div>
    <div><p id=”pincode_response”></p></div>

    <script>
    function checkPincode() {
    var pincode = document.getElementById(“shiprocket_pincode_check”).value;
    if(pincode == ”){
    jQuery(‘#pincode_response’).text(“This pincode field is required!”)
    }else{
    var url = “<?php echo SHIPROCKET_WC_RATE_URL; ?>”;

    url += “?weight=” + “<?php echo $product->weight; ?>” + “&cod=1&delivery_postcode=” + pincode;

    url += “&store_url=” + “<?php echo get_site_url(); ?>”;

    url += “&merchant_id=” + “<?php echo $settings[‘integration_id’];?>”;

    url += “&unit=” + “<?php echo get_option(‘woocommerce_weight_unit’);?>”;

    var token = ‘ACCESS_TOKEN:’ + ‘<?php echo SHIPROCKET_ACCESS_TOKEN; ?>’;

    jQuery.ajax({
    url: url,
    headers: {‘authorization’: token},
    success: function(response) {
    if(response.status == 200) {
    var recommeded_courier_id = response.data.recommended_courier_company_id;
    var available_couriers = response.data.available_courier_companies;
    var recommeded_courier = available_couriers.filter(c => c.courier_company_id == recommeded_courier_id);
    if(recommeded_courier_id !== null && recommeded_courier_id !== ”){
    var recommeded_courier = available_couriers.filter(c => c.courier_company_id == recommeded_courier_id);
    var etd = recommeded_courier[0].etd;
    }else{
    var etd = available_couriers[0].etd;
    }
    var msg = <span>You’ll get your product by + etd + !</span>;

    jQuery(‘#pincode_response’).html(msg);
    }
    else {
    jQuery(‘#pincode_response’).text(“This pincode is not serviceable!”)
    }
    },
    error: function(error){
    jQuery(‘#pincode_response’).text(“This pincode is not serviceable!”)
    }
    });
    }
    }

    </script>
    <?php
    }

    just add in functions.php

    remove_action(‘woocommerce_single_product_summary’, ‘shiprocket_show_check_pincode’, 20);

    Have fun ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable Check Pincode’ is closed to new replies.