docs: added dividers + see also section (#2899)

This commit is contained in:
Shahed Nasser
2022-12-26 15:52:08 +02:00
committed by GitHub
parent b0e5769e27
commit b0ebfd6bcf
100 changed files with 1047 additions and 291 deletions
+19 -3
View File
@@ -21,6 +21,8 @@ This document does not cover implementing the checkout flow. You can refer to [t
- **Line Item**: When products are added to the cart in Medusa, they are referred to as line items. Line items have, by default, the same properties and attributes as a product. However, you can customize line items specifically for a cart if necessary.
---
## Prerequisites
### Medusa Components
@@ -35,6 +37,8 @@ This guide includes code snippets to send requests to your Medusa server using M
If you follow the JS Client code blocks, its assumed you already have [Medusas JS Client installed](../js-client/overview.md) and have [created an instance of the client](../js-client/overview.md#configuration).
---
## Create a Cart
You can create a cart with the following code snippet:
@@ -123,6 +127,8 @@ The region a cart is associated with determines the currency the cart uses, the
:::
---
## Retrieve a Cart
Notice that in the previous code snippets, you set the carts ID in the local storage. This is helpful to persist the customers cart even when they leave the website and come back later.
@@ -169,6 +175,8 @@ Make sure to remove the ID from the local storage after the customer places an o
:::
---
## Update a Cart
A cart has different data associated with it including the region, email, address, customer, and more.
@@ -288,6 +296,8 @@ fetch(`<SERVER_URL>/store/carts/${cartId}`, {
</TabItem>
</Tabs>
---
## Add Line Item to the Cart
To create a line item of a product and add it to a cart, you can use the following code snippet:
@@ -337,6 +347,8 @@ If youre using Sales Channels, make sure that the cart and the product belong
:::
---
## Update Line Item in the Cart
To update a line item's quantity in the cart, you can use the following code snippet:
@@ -376,6 +388,8 @@ This request accepts the ID of the cart and the ID of the line item as path para
It returns the updated cart.
---
## Delete a Line Item from the Cart
To delete a line item from the cart, you can use the following code snippet:
@@ -407,7 +421,9 @@ This request accepts the ID of the cart and the ID of the line item as path para
It returns the updated cart.
## Whats Next
---
- Learn [how to implement the checkout flow in your storefront](../advanced/storefront/how-to-implement-checkout-flow.mdx).
- Learn more about the [JS Client and how to use it](../js-client/overview.md).
## See Also
- [Implement the checkout flow in your storefront](../advanced/storefront/how-to-implement-checkout-flow.mdx)
- [Medusa JS Client Overview](../js-client/overview.md)