Child pages
  • [in-commerce] Incorrect shipping types during checkout, when US address without state entered [5.2.2-B1]
Skip to end of metadata
Go to start of metadata

The "shipping quote engine" concept in In-Commerce is used to represent a service (e.g. FedEx, UPS, Intershipper), that once supplied with an address and package information will returns allowed shipping types (e.g. "FedEx Ground", "UPS Same Day", etc.). 

The "ShippingQuoteCollector::GetShippingQuotes" method, that performs queries to each of enabled in In-Commerce services contains following code, that doesn't query service at all, when:

  • this is US or Canada address (shipping address country has states)
  • state wasn't entered as part of shipping address during checkout
$has_states = $cs_helper->CountryHasStates( $cs_helper->getCountryIso($params['dest_country'], true) );

if (
   !$params['dest_city'] || !$params['dest_country'] ||
   ($has_states && !$params['dest_state']) ||
   !$params['dest_postal'] || !$params['packages']
) {
   return Array ();

The $params['dest_country'] in above code contains value from "Orders.ShippingCountry" database column in ISO 3-symbol format (e.g. USA). Then it is excessively converted with CountryStatesHelper::getCountryIso method call, which always results in false value, that is passed to CountryStatesHelper::CountryHasStates method and results in wrong $has_states value for cases, when country has states.

As result, shipping quote engines are queried ignoring the fact, that state isn't even entered. Some services have fallback code, that returns results by entered zip code, when state is missing. That fallback code will of course make user think, that everything is alright, while it isn't.


  1. excessive conversion must be removed
  2. the $params['dest_country'] variable must be directly passed to the CountryStatesHelper::CountryHasStates method

Related Tasks

MINC-141 - Getting issue details... STATUS

1 Comment

  1. Sponsored by rRPI21181.