chore: Merge master to develop (#3653)

This commit is contained in:
Oliver Windall Juhl authored and GitHub committed 2023-03-31 13:09:57 +02:00
1 parent b2e2eddcea
commit 809ab2e0eb
120 files changed
+2240 -585

No files matched your search

@@ -0,0 +1,54 @@
# ipstack (IP Lookup)
Automatically detect the region and location of your customer using ipstack.
[Medusa Website](https://medusajs.com/) | [Medusa Repository](https://github.com/medusajs/medusa)
## Features
- Look up the location of your customer using ipstack.
- Provides a middleware that can be added to any request to set the region and country of a cart.
- Provides a service that can be used across codebase to detect the location of a user using their IP.
---
## Prerequisites
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
- [ipstack account](https://ipstack.com)
---
## How to Install
1\. Run the following command in the directory of the Medusa backend:
```bash
npm install medusa-plugin-ip-lookup
```
2\. Set the following environment variable in `.env`:
```bash
IPSTACK_ACCESS_KEY=<YOUR_ACCESS_KEY>
```
3\. In `medusa-config.js` add the following at the end of the `plugins` array:
```js
const plugins = [
// other plugins...
{
resolve: `medusa-plugin-ip-lookup`,
options: {
access_token: process.env.IPSTACK_ACCESS_KEY,
},
},
]
```
---
## Test the Plugin
You can use the `IpLookupService` service to look up the location of an IP, or use the middleware `preCartCreation` on any route.