docs: small fixes across the documentation (#2692)
* docs: various bug fixes * docs: add the import in other storage plugins * docs: fixed the placement of manual taxes doc
This commit is contained in:
@@ -187,18 +187,22 @@ If you’re using a [Next.js](../starters/nextjs-medusa-starter.md) storefront,
|
||||
|
||||
If this configuration is not added, you’ll receive the error ["next/image Un-configured Host”](https://nextjs.org/docs/messages/next-image-unconfigured-host).
|
||||
|
||||
In `next.config.js` add the following option in the exported object:
|
||||
In `next.config.js` add the following option in the exported object:
|
||||
|
||||
```jsx
|
||||
module.exports = {
|
||||
//other options
|
||||
images: {
|
||||
const { withStoreConfig } = require("./store-config")
|
||||
|
||||
//...
|
||||
|
||||
module.exports = withStoreConfig({
|
||||
//...
|
||||
images: {
|
||||
domains: [
|
||||
"127.0.0.1",
|
||||
//any other domains...
|
||||
//...
|
||||
"127.0.0.1",
|
||||
],
|
||||
},
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Where `127.0.0.1` is the domain of your local MinIO server.
|
||||
|
||||
@@ -157,6 +157,10 @@ If this configuration is not added, you’ll receive the error ["next/image Un-
|
||||
In `next.config.js` add the following option in the exported object:
|
||||
|
||||
```jsx
|
||||
const { withStoreConfig } = require("./store-config")
|
||||
|
||||
//...
|
||||
|
||||
module.exports = withStoreConfig({
|
||||
//...
|
||||
images: {
|
||||
|
||||
@@ -144,6 +144,10 @@ If this configuration is not added, you’ll receive the error ["next/image Un-
|
||||
In `next.config.js` add the following option in the exported object:
|
||||
|
||||
```jsx
|
||||
const { withStoreConfig } = require("./store-config")
|
||||
|
||||
//...
|
||||
|
||||
module.exports = withStoreConfig({
|
||||
//...
|
||||
images: {
|
||||
|
||||
@@ -16,7 +16,7 @@ You also need to [setup Redis](../../../tutorial/0-set-up-your-development-envir
|
||||
|
||||
## Create a Notification Provider
|
||||
|
||||
Creating a Notification Provider is as simple as creating a TypeScript or JavaScript file in `src/services`. The name of the file is the name of the provider (for example, `sendgrid.ts`). A Notification Provider is essentially a Service that extends the `NotificationService` from `medusa-interfaces`.
|
||||
Creating a Notification Provider is as simple as creating a TypeScript or JavaScript file in `src/services`. The name of the file is the name of the provider (for example, `sendgrid.ts`). A Notification Provider is essentially a Service that extends the `AbstractNotificationService` from `@medusajs/medusa`.
|
||||
|
||||
For example, create the file `src/services/email-sender.ts` with the following content:
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ The [Calculate Cart Taxes](https://docs.medusajs.com/api/store/#tag/Cart/operati
|
||||
|
||||
This calculates and retrieves the taxes on the cart and each of the line items in that cart.
|
||||
|
||||
### Use CartService
|
||||
### Use CartService's retrieve Method
|
||||
|
||||
The `CartService` class has a method `retrieve` that gets a cart by ID. In that method, taxes are calculated only if automatic taxes calculation is enabled for the region the cart belongs to.
|
||||
|
||||
@@ -36,13 +36,11 @@ You can learn how to [retrieve and use services](../services/create-service.md#u
|
||||
|
||||
:::
|
||||
|
||||
### Use decorateLineItemsWithTotals function in Endpoints
|
||||
### Use CartService's decorateTotals Method
|
||||
|
||||
If you want to calculate the taxes of line items on the storefront in an endpoint and return the necessary fields in the result, you can use the `decorateLineItemsWithTotals` method in your endpoint:
|
||||
Another way you can use the `CartService` to calculate taxes is using the method `decorateTotals`:
|
||||
|
||||
```jsx
|
||||
//at the beginning of the file
|
||||
import { decorateLineItemsWithTotals } from "@medusajs/medusa/dist/api/routes/store/carts/decorate-line-items-with-totals"
|
||||
|
||||
export default () => {
|
||||
//...
|
||||
@@ -54,16 +52,16 @@ export default () => {
|
||||
|
||||
//...
|
||||
//retrieve taxes of line items
|
||||
const data = await decorateLineItemsWithTotals(cart, req, {
|
||||
const data = await decorateTotals(cart, {
|
||||
force_taxes: true
|
||||
});
|
||||
})
|
||||
|
||||
return res.status(200).json({ cart: data });
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
The `decorateLineItemsWithTotals` method accepts an options object as a third parameter. If you set `force_taxes` to `true` in that object, the totals of the line items can be retrieved regardless of whether the automatic calculation is enabled in the line item’s region.
|
||||
The `decorateTotals` method accepts the cart as a first parameter and an options object as a second parameter. If you set `force_taxes` to `true` in that object, the totals of the line items can be retrieved regardless of whether the automatic calculation is enabled in the line item’s region.
|
||||
|
||||
### Use TotalsService
|
||||
|
||||
|
||||
@@ -209,6 +209,11 @@ module.exports = {
|
||||
id: "advanced/storefront/how-to-implement-checkout-flow",
|
||||
label: "Implement Checkout"
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "advanced/backend/taxes/manual-calculation",
|
||||
label: "Calculate Taxes Manually"
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "advanced/storefront/use-sales-channels",
|
||||
@@ -230,11 +235,6 @@ module.exports = {
|
||||
id: "advanced/admin/import-prices",
|
||||
label: "Import Prices"
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "advanced/backend/taxes/manual-calculation",
|
||||
label: "Calculate Taxes Manually"
|
||||
},
|
||||
{
|
||||
type: "doc",
|
||||
id: "advanced/backend/price-lists/use-api",
|
||||
|
||||
Reference in New Issue
Block a user