Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It struck me that there is not really any reason for the Ajax call when the user changes the country dropdown; the list of zones is small and static and could just be sent in the HTML body, and immediately altered through JavaScript. Even with all countries enabled the overhead of including all states in the HTML is minimal compared to the time needed for the Ajax request and the complexity of the code behind this feature.
Comments
Comment #2
TR CreditAttribution: TR commentedThinking out loud ...
I think most sites enable either:
1) Only one or two countries
2) All countries
(#2 is a mistake IMO, as no-one can possibly support selling and shipping to all countries).
Certainly if a site only has a few countries then this change will make the checkout page more responsive, so sounds good to me. If a site has all or a large number of countries enabled, loading 250 entities to generate the checkout page and managing ~5000 zone options with JavaScript sounds slow, but as I said I think it's a mistake to enable all countries. Still, I'd like to see how it affects performance in practice before putting this in.