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

USPS Shipping (RESTful) (USPSr)

Sticky

Views: 54,966

Results 521 to 540 of 558
21 May 2026, 7:31 AM
#521
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

USPS Shipping (RESTful) (USPSr)

ZC 2.2.2 with PHP 8.4

[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1#0 [internal function]: zen_debug_error_handler()
#1 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(416): json_decode()
#2 /includes/classes/shipping.php(266): uspsr->quote()
#3 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#4 /index.php(40): require('/home/zqxstefl/...')
--> PHP Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 416.


[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1
#0 [internal function]: zen_debug_error_handler()
#1 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(430): json_decode()
#2 /includes/classes/shipping.php(266): uspsr->quote()
#3 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#4 /index.php(40): require('/home/zqxstefl/...')
--> PHP Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 430.

and

[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1#0 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(450): zen_debug_error_handler()
#1 /includes/classes/shipping.php(266): uspsr->quote()
#2 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#3 /index.php(40): require('/home/zqxstefl/...')
--> PHP Warning: Trying to access array offset on null in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 450.


[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1
#0 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(450): zen_debug_error_handler()
#1 /includes/classes/shipping.php(266): uspsr->quote()
#2 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#3 /index.php(40): require('/home/zqxstefl/...')
--> PHP Warning: Trying to access array offset on null in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 450.


[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1
#0 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(451): zen_debug_error_handler()
#1 /includes/classes/shipping.php(266): uspsr->quote()
#2 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#3 /index.php(40): require('/home/zqxstefl/...')
--> PHP Warning: Trying to access array offset on null in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 451.


[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1
#0 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(451): zen_debug_error_handler()
#1 /includes/classes/shipping.php(266): uspsr->quote()
#2 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#3 /index.php(40): require('/home/zqxstefl/...')
--> PHP Warning: Trying to access array offset on null in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 451.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

21 May 2026, 10:23 AM
#522
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)

dbltoe:

ZC 2.2.2 with PHP 8.4

[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1#0 [internal function]: zen_debug_error_handler()
#1 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(416): json_decode()
#2 /includes/classes/shipping.php(266): uspsr->quote()
#3 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#4 /index.php(40): require('/home/zqxstefl/...')
--> PHP Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 416.

[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1
#0 [internal function]: zen_debug_error_handler()
#1 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(430): json_decode()
#2 /includes/classes/shipping.php(266): uspsr->quote()
#3 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#4 /index.php(40): require('/home/zqxstefl/...')
--> PHP Deprecated: json_decode(): Passing null to parameter #1 ($json) of type string is deprecated in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 430.

> and
> ```
[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1#0 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(450): zen_debug_error_handler()
#1 /includes/classes/shipping.php(266): uspsr->quote()
#2 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#3 /index.php(40): require('/home/zqxstefl/...')
--> PHP Warning: Trying to access array offset on null in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 450.


[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1
#0 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(450): zen_debug_error_handler()
#1 /includes/classes/shipping.php(266): uspsr->quote()
#2 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#3 /index.php(40): require('/home/zqxstefl/...')
--> PHP Warning: Trying to access array offset on null in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 450.


[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1
#0 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(451): zen_debug_error_handler()
#1 /includes/classes/shipping.php(266): uspsr->quote()
#2 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#3 /index.php(40): require('/home/zqxstefl/...')
--> PHP Warning: Trying to access array offset on null in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 451.


[21-May-2026 03:35:00 UTC] Request URI: /index.php?main_page=checkout_one, IP address: 123.234.432.321, Language id 1
#0 /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php(451): zen_debug_error_handler()
#1 /includes/classes/shipping.php(266): uspsr->quote()
#2 /includes/modules/pages/checkout_one/header_php.php(220): shipping->quote()
#3 /index.php(40): require('/home/zqxstefl/...')
--> PHP Warning: Trying to access array offset on null in /zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shipping/uspsr.php on line 451.

How often is this warning happening? Can you possibly include the Debugger log from the module that has the configuration report.?

21 May 2026, 2:08 PM
#523
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,969
Plugin Contributions:
8

Re: USPS Shipping (RESTful) (USPSr)

retched:

How often is this warning happening? Can you possibly include the Debugger log from the module that has the configuration report.?

hmmm....

when i look at this section of code, it seems that if the weight is 0, you are never getting a quote, and therefore $this->pkgQuote will be null...

i could be wrong, but that's what it looks like to me.

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

21 May 2026, 8:14 PM
#524
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
374
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

It is the same warning I reported several days ago, regarding line 450 & 451. It is an intermittent issue.

21 May 2026, 9:12 PM
#525
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,969
Plugin Contributions:
8

Re: USPS Shipping (RESTful) (USPSr)

njcyx:

It is the same warning I reported several days ago, regarding line 450 & 451. It is an intermittent issue.

yes. it is.

if the weight of the items in your cart is 0, it will not get any quotes.

but it not really intermittent. that implies an irregular interval.

by looking at the code, if your weight is 0, it appears to happen with regularity.

best.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

27 May 2026, 7:05 PM
#526
njcyx avatar

njcyx

Zen Follower

Join Date:
Apr 2019
Posts:
374
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

carlwhat:

yes. it is.

if the weight of the items in your cart is 0, it will not get any quotes.

but it not really intermittent. that implies an irregular interval.

by looking at the code, if your weight is 0, it appears to happen with regularity.

best.

Hmm. I wrote a code in the plug-in, so when weight is less than 0.1, force to change the weight to 0.1. But it doesn't work on my case. I can still receive this type of intermitent warning.

27 May 2026, 7:12 PM
#527
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)

njcyx:

Hmm. I wrote a code in the plug-in, so when weight is less than 0.1, force to change the weight to 0.1. But it doesn't work on my case. I can still receive this type of intermitent warning.

I could have sworn that I fixed this in a prior patch. I will start this later today (again).

12 Jun 2026, 12:11 PM
#528
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,848
Plugin Contributions:
17

Re: USPS Shipping (RESTful) (USPSr)

retched:

I could have sworn that I fixed this in a prior patch. I will start this later today (again).

The February fix did attempt to fix the zero-weight problem, but the checks need to be rearranged in order to happen in the correct sequence and the Free Shipper shipping module needs to be installed if the product is free-shipping.

Suggestions that worked for me:

File - zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shippiong/uspsr.php

Find around line 406 - ```
$this->_calcCart(); $this->quoteLogConfiguration();

    // Create the main quotes (both letters and packages)
    // Remove the tare weight from the quote weight first. If there is no weight, don't send.
    if ($this->items_weight > 0) $this->_getQuote();

Replace with ```
        $this->_calcCart();        $this->quoteLogConfiguration();


        // === POLISHED ZERO-WEIGHT HANDLING ===
        // Initialize these to prevent json_decode(null) deprecation warnings in PHP 8.4+
        // when the cart contains only free shipping items (weight = 0).
        $this->pkgQuote = '';
        $this->ltrQuote = '';
        $this->uspsStandards = [];


        // Skip USPS API calls entirely for zero-weight carts.
        // Free shipping / zero-weight items are now properly handled by the core
        // Free Shipper + Free Charger modules.
        if ($this->items_weight > 0) {
            $this->_getQuote();
        } else {
            $this->uspsrDebug('Skipping USPS quote request: items_weight is zero (free shipping item).');
        }

Find around line 415 - ```
// Start with package quote $uspsQuote = json_decode($this->pkgQuote, TRUE);

    // Notifier brought forward
    $this->notify('NOTIFY_SHIPPING_USPS_AFTER_GETQUOTE', [], $order, $this->quote_weight, $shipping_num_boxes, $this->dimensions, $uspsQuote);


    if (!empty($uspsQuote['error'])) {
        ...
    }


    // Take the Letters Quote and add it to a temp holder
    $_letter = json_decode($this->ltrQuote, TRUE);


    // If there isn't a quote in letters don't bother.
    if (isset($_letter['rates'])) {
        ...
    } else {
        $this->errors[] = [
            'message' => "Letters: " . $_letter['error']['message'],
            'code' => $_letter['error']['code']
        ];
    }

Replace with ```
        // Start with package quote        $uspsQuote = json_decode($this->pkgQuote, TRUE);
        if (!is_array($uspsQuote)) {
            $uspsQuote = [];
        }


        // Notifier brought forward
        $this->notify('NOTIFY_SHIPPING_USPS_AFTER_GETQUOTE', [], $order, $this->quote_weight, $shipping_num_boxes, $this->dimensions, $uspsQuote);


        if (!empty($uspsQuote['error'])) {
            $this->errors[] = [
                'message' => "Packages: " . $uspsQuote['error']['message'],
                'code' => $uspsQuote['error']['code']
            ];
        }


        // Take the Letters Quote and add it to a temp holder
        $_letter = json_decode($this->ltrQuote, TRUE);


        // If there isn't a quote in letters don't bother.
        if (is_array($_letter) && isset($_letter['rates'])) {
            // Force the details of the Letter Request to match the other pieces from packages
            $_letter['rates'][0]['mailClass'] .= "_" . strtoupper(MODULE_SHIPPING_USPSR_LTR_PROCESSING);
            $_letter['rates'][0]['productName'] = ($this->is_us_shipment ? 'First-Class Mail Letter' : 'First-Class Mail International Letter');
            $_letter['rates'][0]['processingCategory'] = MODULE_SHIPPING_USPSR_LTR_PROCESSING;


            if ($this->is_us_shipment) {
                $_letter['rates'][0]['price'] += 0.04;
                $_letter['totalBasePrice'] += 0.04;
            }


            $uspsQuote['rateOptions'][] = $_letter;


        } else {
            // Safe handling for zero-weight carts or when no letter rates are returned
            if (is_array($_letter) && isset($_letter['error']['message']) && isset($_letter['error']['code'])) {
                $this->errors[] = [
                    'message' => "Letters: " . $_letter['error']['message'],
                    'code' => $_letter['error']['code']
                ];
            } else {
                $this->uspsrDebug('No valid letter quote response (zero weight cart or no letter services configured).');
            }
        }

Replace the existing zero-weight check near the end of the file (around line 1039) with - ```
if ($this->items_weight <= 0) { // Zero weight cart — Free Shipper + Free Charger modules are handling this.
// Return no methods so we don't interfere with other shipping/payment options.
$this->quotes = [
'id' => $this->code,
'icon' => zen_image($this->icon),
'module' => $this->title,
'methods' => [],
];

    } elseif (empty($build_quotes) && empty($this->errors)) {

If you have an item that is free shipping and free to purchase, both Free Shipper and Free Order will need to be installed.

The above changes work in a ZC 2.2.2 environment with PHP 8.4.21, PayPal Restful, Square WebPay, and One Page Checkout.

@carlwhat - PayPal Restful automatically drops out when the cart is $0.00. It appears that Square WebPay does not and let's Free Order prevail. Perhaps having WebPay act like PayPal could alleviate problems for those that don't have Free Order installed. Not something I have tested fully so I don't know if you could successfully check out without Free Order. I do know WebPay does not appear when the cart is $0 and Free Order is installed.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

12 Jun 2026, 1:51 PM
#529
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:

Just installed this in 1.5.7c. No install issues that I have found

Thanks for letting me know. I tried to run at least an install/quote run of each major version from 1.5.5 onward. I will come back to 1.5.4 and before but it's not a priority (since that one uses PHP 5).

split63:

I did discover that a feather weight product had its weight set to 0, and this resulted in no shipping output. Yet the min was set to 0.

This is the intended behavior. If there is no weight, no quote request will be sent even if it is enabled.

split63:

Regarding the handling time, there is not one for international. We ship only USPS 1st Class for international. I like to add in a large handling time, because USPS International is unpredictable as its government to government shipping.

This is sort of handled, I just list as "varies by destination country". There is a way for me retrieve the actual time quotes but I'd rather not as that would need me to send out like 5 requests to the USPS. And they are all bad. There is a field to add "handling days" and that will add to the estimate 8 and 30 days. For example, if you add 10 handling days, it will output as 18 and 41 days as an estimate.

split63:

Regarding the shipping cost shown, there is an option for "Retail" or "Commercial". Is the "Commercial" amount accurate, regardless of the provider used? For example, ShipRush, ShipWorks, Stamps.com, etc.

Retail is the equivalent of walking up to the retail counter and having them price it.

Commercial is the equivalent of using almost any service online such as the ones you listed plus Pirate Ship and others. If you have a contract with the Postal Service and you have a valid contract number, you can choose NSA and select the appropriate types and it will generate the quotes off that contract.

12 Jun 2026, 1:52 PM
#530
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)

dbltoe:

The February fix did attempt to fix the zero-weight problem, but the checks need to be rearranged in order to happen in the correct sequence and the Free Shipper shipping module needs to be installed if the product is free-shipping.

Suggestions that worked for me:

File - zc_plugins/USPSRestful/v1.8.4/catalog/includes/modules/shippiong/uspsr.php

Find around line 406 - ```
$this->_calcCart(); $this->quoteLogConfiguration();

    // Create the main quotes (both letters and packages)
    // Remove the tare weight from the quote weight first. If there is no weight, don't send.
    if ($this->items_weight > 0) $this->_getQuote();
> 
> Replace with ```
        $this->_calcCart();        $this->quoteLogConfiguration();


        // === POLISHED ZERO-WEIGHT HANDLING ===
        // Initialize these to prevent json_decode(null) deprecation warnings in PHP 8.4+
        // when the cart contains only free shipping items (weight = 0).
        $this->pkgQuote = '';
        $this->ltrQuote = '';
        $this->uspsStandards = [];


        // Skip USPS API calls entirely for zero-weight carts.
        // Free shipping / zero-weight items are now properly handled by the core
        // Free Shipper + Free Charger modules.
        if ($this->items_weight > 0) {
            $this->_getQuote();
        } else {
            $this->uspsrDebug('Skipping USPS quote request: items_weight is zero (free shipping item).');
        }

Find around line 415 - ```
// Start with package quote $uspsQuote = json_decode($this->pkgQuote, TRUE);

    // Notifier brought forward
    $this->notify('NOTIFY_SHIPPING_USPS_AFTER_GETQUOTE', [], $order, $this->quote_weight, $shipping_num_boxes, $this->dimensions, $uspsQuote);


    if (!empty($uspsQuote['error'])) {
        ...
    }


    // Take the Letters Quote and add it to a temp holder
    $_letter = json_decode($this->ltrQuote, TRUE);


    // If there isn't a quote in letters don't bother.
    if (isset($_letter['rates'])) {
        ...
    } else {
        $this->errors[] = [
            'message' => "Letters: " . $_letter['error']['message'],
            'code' => $_letter['error']['code']
        ];
    }
> 
> Replace with ```
        // Start with package quote        $uspsQuote = json_decode($this->pkgQuote, TRUE);
        if (!is_array($uspsQuote)) {
            $uspsQuote = [];
        }


        // Notifier brought forward
        $this->notify('NOTIFY_SHIPPING_USPS_AFTER_GETQUOTE', [], $order, $this->quote_weight, $shipping_num_boxes, $this->dimensions, $uspsQuote);


        if (!empty($uspsQuote['error'])) {
            $this->errors[] = [
                'message' => "Packages: " . $uspsQuote['error']['message'],
                'code' => $uspsQuote['error']['code']
            ];
        }


        // Take the Letters Quote and add it to a temp holder
        $_letter = json_decode($this->ltrQuote, TRUE);


        // If there isn't a quote in letters don't bother.
        if (is_array($_letter) && isset($_letter['rates'])) {
            // Force the details of the Letter Request to match the other pieces from packages
            $_letter['rates'][0]['mailClass'] .= "_" . strtoupper(MODULE_SHIPPING_USPSR_LTR_PROCESSING);
            $_letter['rates'][0]['productName'] = ($this->is_us_shipment ? 'First-Class Mail Letter' : 'First-Class Mail International Letter');
            $_letter['rates'][0]['processingCategory'] = MODULE_SHIPPING_USPSR_LTR_PROCESSING;


            if ($this->is_us_shipment) {
                $_letter['rates'][0]['price'] += 0.04;
                $_letter['totalBasePrice'] += 0.04;
            }


            $uspsQuote['rateOptions'][] = $_letter;


        } else {
            // Safe handling for zero-weight carts or when no letter rates are returned
            if (is_array($_letter) && isset($_letter['error']['message']) && isset($_letter['error']['code'])) {
                $this->errors[] = [
                    'message' => "Letters: " . $_letter['error']['message'],
                    'code' => $_letter['error']['code']
                ];
            } else {
                $this->uspsrDebug('No valid letter quote response (zero weight cart or no letter services configured).');
            }
        }

Replace the existing zero-weight check near the end of the file (around line 1039) with - ```
if ($this->items_weight <= 0) { // Zero weight cart — Free Shipper + Free Charger modules are handling this.
// Return no methods so we don't interfere with other shipping/payment options.
$this->quotes = [
'id' => $this->code,
'icon' => zen_image($this->icon),
'module' => $this->title,
'methods' => [],
];

    } elseif (empty($build_quotes) && empty($this->errors)) {
> 
> If you have an item that is free shipping and free to purchase, both Free Shipper and Free Order will need to be installed.
> 
> The above changes work in a ZC 2.2.2 environment with PHP 8.4.21, PayPal Restful, Square WebPay, and One Page Checkout.
> 
> @carlwhat - PayPal Restful automatically drops out when the cart is $0.00. It appears that Square WebPay does not and let's Free Order prevail. Perhaps having WebPay act like PayPal could alleviate problems for those that don't have Free Order installed. Not something I have tested fully so I don't know if you could successfully check out without Free Order. I do know WebPay does not appear when the cart is $0 and Free Order is installed.

I'll start to make these changes for the next version pass, thanks dbltoe!
12 Jun 2026, 2:17 PM
#531
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,969
Plugin Contributions:
8

Re: USPS Shipping (RESTful) (USPSr)

dbltoe:

...

If you have an item that is free shipping and free to purchase, both Free Shipper and Free Order will need to be installed.

The above changes work in a ZC 2.2.2 environment with PHP 8.4.21, PayPal Restful, Square WebPay, and One Page Checkout.

@carlwhat - PayPal Restful automatically drops out when the cart is $0.00. It appears that Square WebPay does not and let's Free Order prevail. Perhaps having WebPay act like PayPal could alleviate problems for those that don't have Free Order installed. Not something I have tested fully so I don't know if you could successfully check out without Free Order. I do know WebPay does not appear when the cart is $0 and Free Order is installed.

if you have an issue with square webpay, i would suggest posting in that thread, rather than here. @retched works hard to support this shipping module, so i think it best to not clutter this thread with extraneous stuff.

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

16 Jul 2026, 6:12 PM
#532
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)

I totally didn't mean to submit this as an update to the WebTools module (mods: please deny/delete that update)

New changes coming in 1.8.5

Added in 1.8.5

  • Added new debug log message that will generate when the module installs or upgrades to the next version. Also improved the comparison mechanism between when the versions differ. (This prevents accidental downgrades.)

Removed in 1.8.5

  • Dropped the warning about lower-tiered API access. The USPS has bumped the request limits for basic tiers from 60 requests per hour to 10,000 requests per day. At that point, if you have a high-demand site that receives 10,000 hits per day, you should then reach out and request a higher level of access. [#128]

Fixed in 1.8.5

  • Once again fixed the issue of the zero weight carts not causing the cart to progress correctly. (This bug should have been fixed in 1.8.0 but it wasn’t. dbltoe from the Forums gave a fix that should patch it). [#133]

PLEASE READ THE "README_1st.md" file FIRST

This zip file includes both the Encapsulated and Non-Encapsulated forms of the module. Please read the directions in the included README.html or README.md to see how to install it and which versions of ZenCart are compatible with each version.

As always:

  • Traditional/Manual: Overwrite everything from the admin directory into your admin directory. Overwrite everything from the root/includes directory into the includes directory of the root of your ZenCart.
  • Encapsulated: Upload the zc_plugins directory from the root of the ZIP to the root of your admin. (Nothing should be overwritten as it is a new directory.) Visit the Plugins Manager and upgrade from there.
25 Jul 2026, 11:10 PM
#533
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

I'm running 1.5.8a and recently updated the USPS module to 1.8.5 without a problem. I have around 250 categories/sub-categories (the highest catID is 297, but some categories have been deleted over time, or may not contain any products currently), but only 3 have products that would qualify for Media Mail. To be safe I added a complete list of category numbers 1-300 in the exclude field within the module settings (except the 3 categories); however, the module continues to display Media Mail as an option, even when carts with items from the excluded categories are present. When I try with just one category listed it works fine. So, I'm wondering if I have too many categories and the module is ignoring the string, or perhaps adding catID for non-existent or empty categories possibly causing the issue? Would it be any easier to modify the code to only list the "allowed" categories, which would also be beneficial as new categories are added in the future in case I forget to manually add them to the excluded list? Thanks in advance!

26 Jul 2026, 2:52 PM
#534
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

mcqueeneycoins:

I'm running 1.5.8a and recently updated the USPS module to 1.8.5 without a problem. I have around 250 categories/sub-categories (the highest catID is 297, but some categories have been deleted over time, or may not contain any products currently), but only 3 have products that would qualify for Media Mail. To be safe I added a complete list of category numbers 1-300 in the exclude field within the module settings (except the 3 categories); however, the module continues to display Media Mail as an option, even when carts with items from the excluded categories are present. When I try with just one category listed it works fine. So, I'm wondering if I have too many categories and the module is ignoring the string, or perhaps adding catID for non-existent or empty categories possibly causing the issue? Would it be any easier to modify the code to only list the "allowed" categories, which would also be beneficial as new categories are added in the future in case I forget to manually add them to the excluded list? Thanks in advance!

I appear to have resolved my problem by modifying the preg_split coding in the includes/modules/shipping/uspsr.php file around line 3031:

I changed

$key_values = preg_split('/[\s+]/', MODULE_SHIPPING_USPSR_MEDIA_MAIL_EXCLUDE);

to

$key_values = preg_split('/[\s,]+/', MODULE_SHIPPING_USPSR_MEDIA_MAIL_EXCLUDE);

Whether this would work in all cases I don't know, but if there is a better fix (or perhaps a setting issue I missed that would allow the original code to work) please let me know.

8 Aug 2026, 2:27 PM
#535
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)

mcqueeneycoins:

I appear to have resolved my problem by modifying the preg_split coding in the includes/modules/shipping/uspsr.php file around line 3031:

I changed

$key_values = preg_split('/[\s+]/', MODULE_SHIPPING_USPSR_MEDIA_MAIL_EXCLUDE);

> 
> to
> 
> ```
$key_values = preg_split('/[\s,]+/', MODULE_SHIPPING_USPSR_MEDIA_MAIL_EXCLUDE);

Whether this would work in all cases I don't know, but if there is a better fix (or perhaps a setting issue I missed that would allow the original code to work) please let me know.

Huh, I guess I can make that change. It was originally meant to be space separated but I guess it does make sense to add commas. I'll add this change as well as a change to handle ranges too.

10 Aug 2026, 4:09 PM
#536
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

retched:

Huh, I guess I can make that change. It was originally meant to be space separated but I guess it does make sense to add commas. I'll add this change as well as a change to handle ranges too.

Thank you. Just FYI, the instructions may also need to be updated if you make changes. The current instructions indicate to use commas, which may have been my issue if I was only supposed to use white spaces:

Categories to Excluded from Media Mail
Enter the Category ID of the categories (separated by commas, white spaces surrounding the comma are OK) that fail Media Mail standards.

31 Aug 2026, 9:46 AM
#537
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,720
Plugin Contributions:
56

Re: USPS Shipping (RESTful) (USPSr)

Small issue for installs on very old Zen Cart installations (1.5.5, 1.5.6) - the constant FILENAME_PLUGIN_MANAGER isn't defined, so the reference in admin/includes/languages/english/extra_definitions/uspsr.php on line 42 will fail.

--> PHP Warning: Use of undefined constant FILENAME_PLUGIN_MANAGER - assumed 'FILENAME_PLUGIN_MANAGER' (this will throw an Error in a future version of PHP) in /home/scorpal/public_html/store/admin/includes/languages/english/extra_definitions/uspsr.php on line 42.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

31 Aug 2026, 12:53 PM
#538
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)

swguy:

Small issue for installs on very old Zen Cart installations (1.5.5, 1.5.6) - the constant FILENAME_PLUGIN_MANAGER isn't defined, so the reference in admin/includes/languages/english/extra_definitions/uspsr.php on line 42 will fail.

--> PHP Warning: Use of undefined constant FILENAME_PLUGIN_MANAGER - assumed 'FILENAME_PLUGIN_MANAGER' (this will throw an Error in a future version of PHP) in /home/scorpal/public_html/store/admin/includes/languages/english/extra_definitions/uspsr.php on line 42.

Shocked I let that one get by. I'll start working on patching it out.

31 Aug 2026, 1:33 PM
#539
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,969
Plugin Contributions:
8

Re: USPS Shipping (RESTful) (USPSr)

swguy:

Small issue for installs on very old Zen Cart installations (1.5.5, 1.5.6) - the constant FILENAME_PLUGIN_MANAGER isn't defined, so the reference in admin/includes/languages/english/extra_definitions/uspsr.php on line 42 will fail.

--> PHP Warning: Use of undefined constant FILENAME_PLUGIN_MANAGER - assumed 'FILENAME_PLUGIN_MANAGER' (this will throw an Error in a future version of PHP) in /home/scorpal/public_html/store/admin/includes/languages/english/extra_definitions/uspsr.php on line 42.

the chief cook and bottle washer is supporting old ZC installs as opposed to updating them? 🙁 😮

and then coming to the forum to point out a current plugin does not support it? 😛

oh my....

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

31 Aug 2026, 6:24 PM
#540
chibipaw avatar

chibipaw

Zen Follower

Join Date:
Jul 2011
Posts:
167
Plugin Contributions:
0

Re: USPS Shipping (RESTful) (USPSr)

I'm pretty much stuck on 1.5.5f, not so much that I don’t want to update to the latest and greatest. It’s really due to it being a very active cart with way too many invested modules that are now defunct, and customization to upgrade. While I am using this USPSr plugin, and I'm a bit late on keeping up with the latest update, I dread every time a new version comes out.

carlwhat:

swguy:

Small issue for installs on very old Zen Cart installations (1.5.5, 1.5.6) - the constant FILENAME_PLUGIN_MANAGER isn't defined, so the reference in admin/includes/languages/english/extra_definitions/uspsr.php on line 42 will fail.

--> PHP Warning: Use of undefined constant FILENAME_PLUGIN_MANAGER - assumed 'FILENAME_PLUGIN_MANAGER' (this will throw an Error in a future version of PHP) in /home/scorpal/public_html/store/admin/includes/languages/english/extra_definitions/uspsr.php on line 42.

the chief cook and bottle washer is supporting old ZC installs as opposed to updating them? 🙁 😮

and then coming to the forum to point out a current plugin does not support it? 😛

oh my....