Ensuring Consistent Country Data in ESHOPMAN: A Community Insight

Achieving Data Consistency for Country Names in ESHOPMAN Admin UI

The ESHOPMAN platform, designed for seamless storefront management within HubSpot CMS, relies on robust data consistency. A recent community discussion highlighted a crucial area for improvement concerning how country names are displayed and managed within the ESHOPMAN Admin UI. This insight explores the challenge, its implications for merchants and developers, and a proposed path to ensure a single, reliable source for country data.

The Challenge: Inconsistent Country Display Names

A key observation from the ESHOPMAN community revealed that country names could appear differently across various screens in the Admin UI. Specifically, when a country's display name was customized in the underlying ESHOPMAN database, the Admin UI presented conflicting information:

  • Settings → Regions → Countries column: Displayed the original, hard-coded name from a static list within the frontend.
  • Open a region → Countries table: Showed the updated, customized name retrieved directly from the ESHOPMAN Admin API and database.

This discrepancy arises because while both screens receive country records via the Admin API, the Regions list component was found to be ignoring the API-provided display_name in favor of its own static lookup.

Reproducing the Inconsistency

The issue can be easily reproduced, demonstrating the need for a unified data source:

  1. Create a region in ESHOPMAN containing a specific country (e.g., 'tw').
  2. With the ESHOPMAN backend running, update the country's display name in your local database:
    UPDATE region_country
    SET display_name = 'Country label test'
    WHERE iso_2 = 'tw';
  3. Refresh the Settings → Regions screen in the Admin UI. The 'Countries' column will still show the original name.
  4. Open that specific region. Its 'Countries' table will correctly display 'Country label test'.

Furthermore, a persistence issue was noted: restarting the ESHOPMAN backend could inadvertently reset customized database names, as the platform's default data loader might upsert bundled names, silently overwriting user-defined changes.

Proposed Solutions for ESHOPMAN

The community discussion outlined a clear set of actions to resolve these inconsistencies and enhance data management within ESHOPMAN:

  1. Consistent API-Driven Display: The ESHOPMAN Admin UI should consistently render country.display_name as returned by the Admin API, eliminating reliance on static frontend lists for country names.
  2. Comprehensive Country API: Introduce a dedicated, authenticated, read-only Admin API endpoint to provide a full list of all countries, including those not yet assigned to any region. This would allow country selectors throughout the Admin UI to dynamically fetch data from a single, authoritative source.
  3. Preserving Customized Data: Implement a robust policy within ESHOPMAN's data loaders to preserve customized country names during platform updates or restarts. Bundled defaults should only initialize missing countries without silently replacing existing, customized entries.

These changes would ensure that ISO codes and existing commerce behavior remain unaffected, focusing solely on the accuracy and consistency of display names.

Technical Deep Dive and Implementation Guidance

For ESHOPMAN developers looking to contribute, the discussion provided specific areas within the codebase that require attention:

  • The component responsible for the 'Countries' column in the Regions list currently uses a static lookup:
    COUNTRIES.find((c) => c.iso_2 === country.iso_2)?.display_name
  • Conversely, the region detail page correctly renders display_name directly from API-provided data.
  • The ESHOPMAN region module's default data loader is responsible for upserting bundled country names, which needs adjustment to respect customized data.

The community is keen to see contributions that involve identifying Admin UI components displaying or selecting countries, utilizing the API's display_name, adding a new Admin API for all countries, and refining the startup policy to preserve customized names.

Community Call to Action

This detailed discussion highlights a crucial area for ESHOPMAN's ongoing development, ensuring a seamless and reliable experience for merchants managing their storefronts via HubSpot. The ESHOPMAN team welcomes contributions from its vibrant developer community to implement these proposed solutions, fostering a platform where data consistency is paramount.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools