This is an old revision of the document!


type:
snippet
category:
shipping
name:
Remove days timeframe from USPS rates
description:
USPS added "1-Day" to their priority rates, this removes them.
versions:
0.6.0, 0.7.0, 0.7.1, 0.7.2, 1.0, 1.1
tags:
snippets, advance
date:
2013-08-07

Remove days timeframe from USPS rates

Recently USPS reworked their priority rates to make it clearer how long a given rate will take in transit. This can be confusing for customers, especially if the products you sell don't ship straight away. This snippet removes the “1-Day”, “2-Day” etc from the rate names. For details on the changes USPS made, see their website.

Step 1: Add Javascript

Paste the following code right before the closing </head> tag of your checkout template:

<script type="text/javascript" charset="utf-8" >
jQuery(document).ready(function() {
        jQuery(document).ajaxComplete(function(event, request, settings) {
                if (settings.url.indexOf('GetShippingCost') != -1) {
                        jQuery(".fc_shipping_service").each(function() {
                                var reg = /\d-day/i;
                                var service = jQuery(this).html();
                                if (reg.test(service)) {
                                        jQuery(this).html(service.replace(reg, "").trim());
                                }
                        })
                }
        });
});
</script>

Site Tools