Closed (fixed)
Project:
Commerce USPS
Version:
2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Jan 2026 at 16:41 UTC
Updated:
10 Feb 2026 at 18:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #5
rhovlandYou're using a double negative which makes the code hard to understand.
The configuration form selection is doing the opposite of what it's supposed to be doing due to the current logic.
This code checks if the rate is not allowed.
But the code that calls it (modified to make reading and debugging easier) is evaluating if any of them are true. The end result is selected categories are allowed and ones that are not selected are skipped.
Additionally the configuration UI for this is confusing. Services are checked to include them. The same logic should be used for category and entry facility.
Changing the logic from exclude to include also greatly simplifies the code.
The changes I made should also mostly fix the tests. I think they need to specify facility_types and categories and they aren't
Comment #6
rhovlandI attempted to add defaults to the config form but even when values are set for categories and facility_types when you load the form all of the boxes are checked again. Dunno if I'm trying to set the defaults wrong or if this is a known bug with the shipping method form.
Comment #7
rhovlandComment #8
rhovlandThe behavior of the API changed sometime this weekend. I believe this was a bug fix for processing categories. However this changed the filtering from "it meets the need" to "the problem remains unsolved" when it comes to only offering the desired rates.
Previously FLATS was returning normal rates and MACHINABLE was returning flat rate box rates.
Now FLATS returns flat rate boxes and MACHINABLE returns normal rates, cubic rates, flat rate boxes.
In my case and I'm sure many other site admins, we only want to offer the base services without any of the discount rates such as cubic or flat rate boxes.
After looking at the API responses and API documentation I think there is one more filter type missing. rateIndicator indicates the type of rate on the response. You can see what the various codes mean here:
https://developers.usps.com/domesticpricesv3
https://developers.usps.com/internationalpricesv3
Domestic and International have different lists but any that appear in both have the same label so it's safe to assume one unified list would be safe to use as a filter for both.
In general most generic rates all have the
SP(Single Piece) indicator with some of the more specific ones based on package size probably beingDN(Dimensional Nonrectangular)DR(Dimensional Rectangular)OS(Oversized)I think having additional information to guide site builders on which filter options to select would be an important thing to add. Also, maybe we want to have a default set of options that gives base rates out of the box? If they want more options they can select additional items in the configuration. Shouldn't expect site builders to be USPS experts to use the module.
Comment #9
rhovlandAdded support for rateIndicator. Code is untested, will work on verifying tomorrow.
Comment #10
jsacksick commentedUpdating the status to "Needs work" because of the failing tests.
Comment #12
tbkot commentedChanges are merged.