https://github.com/opengento/magento2-country-store
This module add the many countries to many stores relation and make it available to the storefront.
https://github.com/opengento/magento2-country-store
country magento magento-2 magento-extension magento-module magento2 magento2-extension magento2-extension-free magento2-module mapper relationship store
Last synced: over 1 year ago
JSON representation
This module add the many countries to many stores relation and make it available to the storefront.
- Host: GitHub
- URL: https://github.com/opengento/magento2-country-store
- Owner: opengento
- License: mit
- Created: 2020-07-30T14:47:39.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-11T17:21:20.000Z (almost 2 years ago)
- Last Synced: 2025-04-23T21:03:18.316Z (over 1 year ago)
- Topics: country, magento, magento-2, magento-extension, magento-module, magento2, magento2-extension, magento2-extension-free, magento2-module, mapper, relationship, store
- Language: PHP
- Homepage: https://opengento.fr/
- Size: 60.5 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Country Store Module for Magento 2
[](https://packagist.org/packages/opengento/module-country-store)
[](./LICENSE)
[](https://packagist.org/packages/opengento/module-country-store/stats)
[](https://packagist.org/packages/opengento/module-country-store/stats)
This module add the many countries to many stores relation and make it available to the storefront.
- [Setup](#setup)
- [Composer installation](#composer-installation)
- [Setup the module](#setup-the-module)
- [Features](#features)
- [Settings](#settings)
- [Documentation](#documentation)
- [Support](#support)
- [Authors](#authors)
- [License](#license)
## Setup
Magento 2 Open Source or Commerce edition is required.
### Composer installation
Run the following composer command:
```
composer require opengento/module-country-store
```
### Setup the module
Run the following magento command:
```
bin/magento setup:upgrade
```
**If you are in production mode, do not forget to recompile and redeploy the static resources.**
## Features
### Country to store mapping
Define many countries to many stores relation. This configuration will allows Magento to map stores with countries.
## Settings
The configuration for this module is available in `Stores > Configuration > General > Country Store`.
## Documentation
### How to add a country resolver
Create a new final class and implements the following interface: `Opengento\CountryStore\Api\CountryResolverInterface`.
The method `public function getCountry(): CountryInterface` should return the default country depending of the context.
The country code should be compliant to ISO 3166-1 alpha-2 format.
Register the new country resolver in the method factory, `Vendor/Module/etc/di.xml`:
```xml
Vendor\Module\Model\Country\Resolver\CustomCountryResolver
```
If you want the resolver to be available in settings, add it to the resolver list, `Vendor/Module/etc/di.xml`:
```xml
Custom Country Resolver
Vendor\Module\Model\Country\Resolver\CustomCountryResolver::RESOLVER_CODE
```
The country resolver is ready to use.
## Support
Raise a new [request](https://github.com/opengento/magento2-country-store/issues) to the issue tracker.
## Authors
- **Opengento Community** - *Lead* - [](https://twitter.com/opengento)
- **Thomas Klein** - *Maintainer* - [](https://github.com/thomas-kl1)
- **Contributors** - *Contributor* - [](https://github.com/opengento/magento2-country-store/graphs/contributors)
## License
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) details.
***That's all folks!***