Merge branch 'master' into develop

This commit is contained in:
olivermrbl committed 2022-12-22 10:43:29 +01:00
commit 5ae319004f
21 files changed
+1026 -114

No files matched your search

@@ -24,8 +24,6 @@ Discounts can be used in many use cases including:
2. Creating a sale within a specific period of time (for example, a summer sale).
3. Give your customers free shipping for a limited time.
![Discounts Architecture](https://res.cloudinary.com/dza7lstvk/image/upload/v1669900544/Medusa%20Docs/Diagrams/discounts_cdxec1.jpg)
---
## Discount Entity Overview
@@ -96,6 +94,8 @@ Based on the value of `type`, one of the following relations can be used to retr
- `product_tags` is an array of product types that this condition applies to if the condition’s `type` is `product_tags`. Each item of the array would be a [`DiscountConditionProductTag`](../../../references/entities/classes/DiscountConditionProductTag.md).
- `customer_groups` is an array of product types that this condition applies to if the condition’s `type` is `customer_groups`. Each item of the array would be a [`DiscountConditionCustomerGroup`](../../../references/entities/classes/DiscountConditionCustomerGroup.md).
![Discounts Architecture](https://res.cloudinary.com/dza7lstvk/image/upload/v1669900544/Medusa%20Docs/Diagrams/discounts_cdxec1.jpg)
---
## What’s Next
@@ -0,0 +1,117 @@
# Regions Overview
In this document, you’ll learn about Regions and their importance in your Medusa server.
## Introduction
Regions represent at least one country on your Medusa server. They're used to define different business logic and configurations for a set of countries.
For example, you can enable one payment provider for region A, and a different payment provider for region B. Customers can then use the payment provider enabled in their region.
This applies to other relations and entities in your store such as different currencies, fulfillment providers, and tax providers.
---
## Region Configurations
The following configurations can be set for each region:
1. The currency used.
2. The tax provider and rates.
3. The countries that belong to that region. A country can only belong to one region.
4. The enabled payment providers.
5. The enabled fulfillment providers.
6. The shipping and return shipping options.
---
## One vs Multiple Regions
Your store needs at least one region so that your customers can place orders.
If you serve customers in different countries that use the same configurations, such as the same currency and payment providers, then you can include more countries in the same region.
If you serve customers in different countries that have at least one different configuration, such as different payment providers, you need to create a new region for those countries.
There is no limit on how many regions you can create, and regions can share similar configurations.
---
## Region Entity Overview
A region is stored in the database as a [Region](../../../references/entities/classes/Region.md) entity. Some of its important attributes are:
- `name`: The name of the region. Customers will see this name on the storefront.
- `tax_rate`: A number that indicates the tax rate. The tax rate is a percentage.
- `tax_code`: An optional string that is used as the code for the default tax rate.
- `gift_cards_taxable`: A boolean value that indicates whether gift cards in a region are taxable or not.
- `automatic_taxes`: A boolean value that indicates whether taxes should be calculated during checkout automatically or manually for that region. You can learn more about manually calculating taxes in [this documentation](../taxes/manual-calculation.md).
---
## Relations to Other Entities
As regions are a core part of your Medusa server, there are many relations to other entities.
This section covers relations to entities that make up the configurations of a region.
![Regions Relations Overview](https://res.cloudinary.com/dza7lstvk/image/upload/v1671465082/Medusa%20Docs/Diagrams/Regions_cg8hsi.jpg)
### Country
A region must have at least one country. A country can belong to only one region.
The relation between the `Region` and `Country` entities is available on both entities:
- You can access the countries that belong to a region by expanding the `countries` relation and accessing `region.countries`.
- You can access the region of a country by expanding the `region` relation and accessing `country.region`. Also, you can access the ID of the region through `country.region_id`.
### Currency
A region must have one currency. A currency can be used for more than one region.
The relation is available on a region by expanding the `currency` relation and accessing `region.currency`. The 3 character currency code can also be accessed through `region.currency_code`.
### FulfillmentProvider
A region must have at least one fulfillment provider. A fulfillment provider can be used in more than one region.
The relation is available on a region by expanding the `fulfillment_providers` relation and accessing `region.fulfillment_providers`.
### PaymentProvider
A region must have at least one payment provider. A payment provider can be used in more than one region.
The relation is available on a region by expanding the `payment_providers` relation and accessing `region.payment_providers`.
### ShippingOption
:::info
Both shipping options and return shipping options are represented by the `ShippingOption` entity. You can learn more in the [Shipping Architecture documentation](../shipping/overview.md#shipping-option).
:::
More than one shipping option can belong to a region. The relation is available on a shipping option by expanding the `region` relation and accessing `shipping_option.region`.
### TaxProvider
A region can have one tax provider. A tax provider can be used for more than one region.
The relation is available on a region by expanding the `tax_provider` relation and accessing `region.tax_provider`. You can also access the ID of the tax provider through `region.tax_provider_id`.
### TaxRate
A region can have more than one tax rate, and a tax rate belongs to one region.
The relation between the `Region` and `TaxRate` entities is available on both entities:
- You can access the tax rates of a region by expanding the `tax_rates` relation and accessing `region.tax_rates`.
- You can access the region of a tax rate by expanding the `region` relation and accessing `tax_rate.region`. You can also access the ID of the region through `tax_rate.region_id`.
---
## What’s Next
- Learn [how to use regions in a storefront using the store REST APIs](../../storefront/use-regions.mdx).
- Learn how to [manage regions using the admin REST APIs](../../admin/manage-regions.mdx).
@@ -0,0 +1,57 @@
---
description: 'Actions Required for Vite Update'
---
# Updating Medusa Admin from Gatsby to Vite
Medusa Admin has been updated to Vite. Learn about breaking changes since the update.
## Overview
Medusa Admin previously was built using Gatsby. As of a recent update, the Admin is now migrated to Vite 3.
This introduced breaking changes related to environment variables used and the published directory. Read below for actions required following this update.
## Required Node.js Version
<!-- vale docs.Numbers = NO -->
Following the change to Vite 3, the required Node.js version for the Admin has changed. [Vite 3](https://vitejs.dev/guide/#scaffolding-your-first-vite-project) requires versions 14.8+ or 16+ of Node.js.
<!-- vale docs.Numbers = YES -->
## Changed Environment Variables
Previously, the Medusa Admin used the environment variables `GATSBY_MEDUSA_BACKEND_URL` or `GATSBY_STORE_URL` to store the Medusa server’s URL.
After the update to Vite, the environment variable name changed to `MEDUSA_BACKEND_URL`.
The Medusa admin remains backward compatible, which means you can still use the same environment variables. However, it is advised to make the change to the new variable.
### Actions Required
Change your `GATSBY_MEDUSA_BACKEND_URL` or `GATSBY_STORE_URL` environment variables to be `MEDUSA_BACKEND_URL`:
```bash
MEDUSA_BACKEND_URL=<YOUR_MEDUSA_SERVER_URL>
```
## Changed Publish Directory
Previously, the build output of the Medusa Admin was placed in the `dist` directory. After this update, the build output is placed in the `public` directory.
For local usage and development, this shouldn’t have an effect. However, this is a breaking change if you deployed Medusa admin.
### Actions Required
If you deployed your Medusa admin, you must change the Publish directory in your hosting.
For Netlify, you can do that by following these steps:
1. On your Medusa admin dashboard, click on “Site settings”.
2. From the sidebar, choose “Build & deploy”.
3. Find the “Build settings” section and click on the “Edit settings” button.
4. Change the “Publish directory” field to `public`.
5. Click on the Save button.
This should trigger a new deployment of your Medusa admin. If not, you must redeploy it manually for changes to take effect.
@@ -1,8 +1,19 @@
---
hide_table_of_contents: true
---
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
import filterListItems from '@site/src/utils/filterListItems';
# Upgrade Guides
Find in this page the upgrade guides that require necessary steps when upgrading to a new version.
<DocCardList items={useCurrentSidebarCategory().items}/>
## Server
<DocCardList items={filterListItems(useCurrentSidebarCategory().items, /^(?!.*\/admin\/).*$/)}/>
## Admin
<DocCardList items={filterListItems(useCurrentSidebarCategory().items, /\/admin\//)}/>