7. CARRINHO
Module: cart
Cart
Bases: MEBase
A factory for a Cart class.
This class provides methods for managing shopping carts in the MelhorEnvio API.
| METHOD | DESCRIPTION |
|---|---|
create |
Create a new cart. |
all |
Get all available carts. |
get |
Get cart information for a given order. |
remove |
Remove a cart. |
create(body: dict) -> dict
Create a new cart .
This method allows you to create a new cart by inserting shipping items into it using the MelhorEnvio API.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
body |
A dictionary containing information about the items to be added to the cart.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the provided request body is not a dictionary. |
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing information about the created cart.
TYPE:
|
Source code in melhorenvio/resources/cart.py
all() -> dict
Get all available cart .
This method retrieves information about all available carts in the MelhorEnvio API.
Usage:
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing information about all available carts.
TYPE:
|
Source code in melhorenvio/resources/cart.py
get(order_id: str) -> dict
Get the cart information for a given order .
This method retrieves information about a specific cart item associated with a given order in the MelhorEnvio API.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
order_id |
The ID of the order for which you want to retrieve cart information.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
A dictionary containing cart information for the specified order.
TYPE:
|
Source code in melhorenvio/resources/cart.py
remove(order_id: str) -> dict | None
Remove a cart.
This method allows you to remove a cart item associated with a given order in the MelhorEnvio API.
Usage:
| PARAMETER | DESCRIPTION |
|---|---|
order_id |
The ID of the order for which you want to remove the cart item.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict | None
|
None |
dict
|
A dictionary containing information about the removed cart item.
TYPE:
|