longclaw icon indicating copy to clipboard operation
longclaw copied to clipboard

Better country management

Open JamesRamm opened this issue 5 years ago • 1 comments

Description

Currently, the site admin/developer needs to call loadcountries on initial setup to get the basic list of countries loaded in. This is:

  • Out of date - it is a hardcoded list so can easily fall out of date
  • Not flexible - no info on regions etc. More often than not, a site admin will want to set shipping rates for a block of countries (e.g. all EU, Rest Of World) rather than per country, which is tedious.

So this issue proposes to:

  1. Use 'RESTCountries' (https://restcountries.eu/#api-endpoints-region) or similar API to get the country list. This will also provide more info on regions etc which can be used in the admin filter
  2. Provide a 'rest of world' option in shipping rates to apply a shipping rate to all countries not previously selected.

Implementation details:

  • It implies that the 'Country' db object will no longer be necessary. We will need to decide how dependent objects identify countries now (code?).

JamesRamm avatar Apr 14 '19 09:04 JamesRamm

Description

Currently, the site admin/developer needs to call loadcountries on initial setup to get the basic list of countries loaded in. This is:

  • Out of date - it is a hardcoded list so can easily fall out of date
  • Not flexible - no info on regions etc. More often than not, a site admin will want to set shipping rates for a block of countries (e.g. all EU, Rest Of World) rather than per country, which is tedious.

So this issue proposes to:

  1. Use 'RESTCountries' (https://restcountries.eu/#api-endpoints-region) or similar API to get the country list. This will also provide more info on regions etc which can be used in the admin filter
  2. Provide a 'rest of world' option in shipping rates to apply a shipping rate to all countries not previously selected.

Implementation details:

  • It implies that the 'Country' db object will no longer be necessary. We will need to decide how dependent objects identify countries now (code?).

Hi @JamesRamm,

Thank you for highlighting the issues with the current setup and proposing a solution. We agree that relying on a hardcoded list of countries can be problematic and not flexible enough for various use cases.

To address these concerns, we propose the following implementation details:

  1. Utilize the 'RESTCountries' API (https://restcountries.eu/#api-endpoints-region) or a similar API to fetch the country list dynamically. This API will provide up-to-date information on countries, including regions, and additional details that can be useful for filtering in the admin panel.

  2. With the new approach, the 'Country' database object will no longer be necessary since we will fetch country data from the API directly. Instead, we need to update the dependent objects (code) to identify countries using the country codes or other unique identifiers provided by the API.

  3. Introduce a "rest of world" option in the shipping rates configuration. This option will allow site admins to set a shipping rate that applies to all countries not previously selected. This will make it easier to manage shipping rates for groups of countries, such as the EU or the rest of the world.

By implementing these changes, we can ensure that the country list remains up to date and provide more flexibility in managing shipping rates based on regions or country groups.

If you have any further questions or need clarification on any aspect of the proposed implementation, please let us know.

Thank you for your attention to this matter.

Best regards, Akshaykumar

akshayaureatelabs avatar May 02 '23 12:05 akshayaureatelabs