Forums / Addon Shipping Modules / USPS Shipping (RESTful) (USPSr)

USPS Shipping (RESTful) (USPSr)

Sticky

Views: 54,964

Results 361 to 380 of 558
7 Jan 2026, 4:05 PM
#361
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

USPS Shipping (RESTful) (USPSr)

split63:

As I examine the module files, I don't see where the text "USPS (First-Class Package International Service)" that is displayed to the customer. is coming from.

So you won't find that line because the way how the rates are retrieved is by pulling them off of the raw API result and then looping through your desired list of selected services. (I do NOT recommend changing this.) What I would have to do is change the logic of the service standards API call (it's a separate one from the rates look up) and modify that so that it outputs, from my example, "USPS (First-Class Package International Service [est. delivery 27-49 days (depending on country)])".

I can take care of this, and was something I was planning on including in a future version. As for delivery date, I can also include an estimation as well about 30 days out. But keep in mind, it would be just that, an estimation, since I cannot use the API to calculate the date. As for the untracked warning, I could try to include a warning about that as well. But would need some kind of standard form so all users can use it.

7 Jan 2026, 5:57 PM
#362
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

While I have tested the module, I have not gone live with it. I know that without that message, I will get customers demanding to know where there order is, even though they have tracking. It would be nice to have some sort of stop gap until you make the change you were planning on.

7 Jan 2026, 7:25 PM
#363
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

Took a couple minutes and abusing ChatGPT:

Estimate Delivery Time:

Estimate Transit Time:

In each of these situations, handling time is set to 1 day. So what would be 8 days is now 9, what would be 30 is now 31. Let me know if this works out and I'll post up a github gist on making this change.

7 Jan 2026, 11:50 PM
#364
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

The 2nd one, simple is better, and nothing absolute. Dates appear absolute

8 Jan 2026, 12:39 AM
#365
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

split63:

The 2nd one, simple is better, and nothing absolute. Dates appear absoluteWell both options are there. Although now that you mention it, I MIGHT make it default to days for international shipments....

Like there is a toggle to either Estimate Delivery Date or Travel time in days.

8 Jan 2026, 1:07 AM
#366
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

For right now, here's the mini patch:

Find in uspsr.php, line 893-894

Should be :

// Build Estimates Attachment 
if (!empty($uspsStandards)) {

Replace that entire block (up to 913, should be a single right-curly brace) with:

            // Build Estimates Attachment
            if ($this->is_us_shipment) {
                if (!empty($uspsStandards)) {
                    switch (MODULE_SHIPPING_USPSR_DISPLAY_TRANSIT) {
                        case "Estimate Transit Time":
                            foreach ($build_quotes as &$quote) {
                                if (isset($uspsStandards[$quote['mailClass']]['serviceStandard'])) $quote['title'] .= " [" . MODULE_SHIPPING_USPSR_TEXT_ESTIMATED . " " . zen_uspsr_estimate_days($uspsStandards[$quote['mailClass']]['serviceStandard']) . "]";
                            }
                            break;
                        case "Estimate Delivery":
                            foreach ($build_quotes as &$quote) {

                                if (isset($uspsStandards[$quote['mailClass']]['delivery']['scheduledDeliveryDateTime'])) {
                                    $est_delivery_raw = new DateTime($uspsStandards[$quote['mailClass']]['delivery']['scheduledDeliveryDateTime']);
                                    $est_delivery = $est_delivery_raw->format(DATE_FORMAT);

                                    $quote['title'] .= " [" . MODULE_SHIPPING_USPSR_TEXT_ESTIMATED_DELIVERY . " " . $est_delivery . "]";
                                }
                            }
                            break;
                    }
                }
            } else {
                switch (MODULE_SHIPPING_USPSR_DISPLAY_TRANSIT) {
                    case "Estimate Transit Time":
                        foreach ($build_quotes as &$quote) {
                            $quote['title'] .= " [" . MODULE_SHIPPING_USPSR_TEXT_ESTIMATED . " " . zen_uspsr_estimate_days("8-30") . ", varies by destination country" . "]";
                        }
                        break;
                    case "Estimate Delivery":
                        foreach ($build_quotes as &$quote) {

                            $early_handling  = 8  + (int) MODULE_SHIPPING_USPSR_HANDLING_TIME;
                            $latest_handling = 30 + (int) MODULE_SHIPPING_USPSR_HANDLING_TIME;

                            $early = new DateTime();
                            $early->modify("+$early_handling days");

                            $late = new DateTime();
                            $late->modify("+$latest_handling days");

                            $quote['title'] .= " [" . MODULE_SHIPPING_USPSR_TEXT_ESTIMATED_DELIVERY . " " . $early->format(DATE_FORMAT) . " - " . $late->format(DATE_FORMAT) . ", varies by destination country]";
                        }
                        break;
                }
            }

There's probably going to be refinements to do this (adding in constants for language defines). But yeah. If you think instead of estimating delivery date at all for international shipments, I can replace this easily for day count instead.

8 Jan 2026, 1:25 AM
#367
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

retched:

There's probably going to be refinements to do this (adding in constants for language defines). But yeah. If you think instead of estimating delivery date at all for international shipments, I can replace this easily for day count instead.
Yes, Day count would be much preferred.

8 Jan 2026, 1:26 AM
#368
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

split63:

Yes, Day count would be much preferred.

Do you use the estimated date for domestic packages?

If not, you can use "Estimate Transit Time" and it will show total days or estimated days for all packages.

8 Jan 2026, 1:30 AM
#369
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

We use FedEx only for International Priority.
All Domestic shipments are USPS, and we do use the day estimates with that module

8 Jan 2026, 1:33 AM
#370
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

split63:

We use FedEx only for International Priority.
All Domestic shipments are USPS, and we do use the day estimates with that module

Yup, I don't have to change anything else. You can use the "Estimate Transit Time" option under the "Display Transit Time" configuration and it will then show you estimated travel days based on the USPS Standard expressed (plus handling days) for domestic shipments or show a range of possible total travel time (the second photo in my example I showed earlier) for internationals.

The code above will show the total days and provides for a possible option, but you have to enable it in the configuration area and make the change I outlined above if you don't want to wait for my update to go through.

8 Jan 2026, 10:51 AM
#371
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

Sorry, I have been working on both the FedEX and USPS modules and got my wires crossed.

For International, we offer USPS 1st Class and FedEx Priority
For USA domestic, we offer USPS Priority and USPS Ground Advantage.
No other options are offered.

I modified the /includes/modules/shipping/uspsr.php as described above. Will be testing it today.

8 Jan 2026, 4:24 PM
#372
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

split63:

Sorry, I have been working on both the FedEX and USPS modules and got my wires crossed.

For International, we offer USPS 1st Class and FedEx Priority
For USA domestic, we offer USPS Priority and USPS Ground Advantage.
No other options are offered.

I modified the /includes/modules/shipping/uspsr.php as described above. Will be testing it today.

Still works out the same. Once you make the changes I posted above,.you'll show an estimation of days traveled to destination. For the domestic shipments, it will use what the USPS calculates from the API. For international, it will show the guestimation of days of 8 to 30 plus your handling setting with a warning that it varies by country.

I staged the improved change on the GitHub with a range of 8 to 30 days plus the handling time setting. I might move that to 45 days but not sure. There is no way for me to pull the international standard estimations from the API and I guess the USPS hid it from documentation (which is weird because I know it was advertised).

8 Jan 2026, 8:21 PM
#373
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

I compared my altered \includes\modules\shipping\uspsr.php to your Github file and they were very different. I used your Github file.

This is what I see for international:

USPS (First-Class Package International Service (est. 10-32 days, MODULE_SHIPPING_USPSR_TEXT_VARIES_BY_DESTINATION))
8 Jan 2026, 8:23 PM
#374
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

split63:

I compared my altered file to your Github file and they were very different. I used your Github file.

This is what I see for international:

USPS (First-Class Package International Service (est. 10-32 days, MODULE_SHIPPING_USPSR_TEXT_VARIES_BY_DESTINATION))


Did you also get the language file change in /includes/languages/english/modules/shipping/lang.uspsr.php? (Or uspsr.php if you're using an older version)

That was the reason I said use the code block I posted above. But since you did it that way, you need the new language files too
8 Jan 2026, 8:45 PM
#375
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

retched:

Did you also get the language file change in /includes/languages/english/modules/shipping/lang.uspsr.php? (Or uspsr.php if you're using an older version)

That was the reason I said use the code block I posted above. But since you did it that way, you need the new language files too

Nope, but that explains why the file compare was so different.
I updated both language files, as I see both had been changed.

The result:

USPS (First-Class Package International Service (est. 10-32 days, varies by destination country))

:cheers:

8 Jan 2026, 10:10 PM
#376
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

split63:

Nope, but that explains why the file compare was so different.
I updated both language files, as I see both had been changed.

The result:

USPS (First-Class Package International Service (est. 10-32 days, varies by destination country))

> :cheers:
Yeah main reason for the large differences in compare is the fact that I never changed the copyright date over on anything. That doesn't affect the code but figured I'd do so in a mid dev cycle. 

Glad it works, means I can release it with no problem later this month.
8 Jan 2026, 11:11 PM
#377
split63 avatar

split63

Totally Zenned

Join Date:
May 2010
Location:
Texas
Posts:
513
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

I pushed it live on our site. Glad I can now ignore the USPS warning me that the old method is being discontinued this month

9 Jan 2026, 5:05 AM
#378
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

split63:

I pushed it live on our site. Glad I can now ignore the USPS warning me that the old method is being discontinued this month

Just be warned you're going to get an annoying development version warning until the update happens.

19 Jan 2026, 6:03 PM
#379
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: USPS Shipping (RESTful) (USPSr)

Now published, version 1.7.0:

Added in 1.7.0

- Added guesstimation of international shipment deliveries. Will warn customers that it varies by country but could be anywhere from 8 to as much as 30 days away. The handling time is added onto these ranges and displayed as a result. [#105] (Pretty much the change I made for split63 above has been implemented.)



Downloads are available in:

Next release will be out in 30 days unless something breaks and requires immediate attention. (There is supposedly a new Priority Mail 1 Day service that should be apart of the API.)

25 Jan 2026, 5:36 AM
#380
jasonshanks avatar

jasonshanks

Zen Follower

Join Date:
Feb 2009
Location:
atlanta GA
Posts:
297
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

will the latest version of this plugin make it so i can keep using USPS shipping ? I am on a older zencart 1.5.6 and USPS 2024-07-15-KLLK , just realized today is the dead line for them killing off the web tools api.

Zencart 1.5.6c PHP 7.2 Order Replacement AC Adapters and Power Cords Online https://www.missingcord.com