Overview
Lunar ships with a full dataset of countries and states that can be imported into your database. These are used across the system for Addresses, shipping zone configuration, tax calculations, and the Regions a store trades in.Countries
Fields
currency is a plain currency code copied from the import source, not a foreign key to Lunar\Core\Models\Currency. It reflects the country’s national currency, not the currencies Lunar is configured to sell in.Relationships
Retrieving countries
States
States (also known as provinces or regions) belong to a country. They are useful for tax calculations and shipping zone configuration.Fields
Relationships
Retrieving states
A state’s
code is only unique within its own country: WA is both Washington and Western Australia. Code lookups used for tax zone resolution scope by country_id to avoid cross-country matches.Importing data
Country and state data is provided by the countries-states-cities-database. Use the following Artisan command to import the data into your database.This command should be run after installing Lunar and after any updates that may include new country or state data.
Countries and regions
A Region is the market a storefront trades in: it groups a channel, currency, language, and tax zone, and is served by a set of countries via thecountry_region pivot. Lunar\Core\Models\Country remains global reference data, unscoped to any region, while Lunar\Core\Models\Region determines which countries map to which market context.