The cart is user-specific and requires a valid Bearer token on every request. All mutating operations (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JuanSCaicedo/Api-Ecommerce/llms.txt
Use this file to discover all available pages before exploring further.
POST, PUT, DELETE) are throttled to 20 requests per minute per user; exceeding this limit returns a 429 Too Many Requests response. Each cart item is uniquely identified by a UUID generated at creation time.
GET /api/ecommerce/cart
Returns all cart items belonging to the authenticated user, ordered by creation time ascending. Thecarts value is wrapped in a data key by the CartEcommerceCollection resource.
Response
The
carts field is an object with a data array (produced by CartEcommerceCollection), not a bare array. The embedded product summary uses price_pen and price_usd as the field names — unlike the full ProductEcommerceResource which uses price_cop.POST /api/ecommerce/cart
Adds a new item to the authenticated user’s cart. The server validates stock availability and rejects duplicate product/variation combinations. Throttled to 20 requests per minute.Body
The ID of the product to add.
The ID of the specific product variation (e.g. a particular color/size combination). Omit or pass
null for products without variations.Number of units to add. Must not exceed available stock (checked server-side against the variation stock if
product_variation_id is provided, or the base product stock otherwise).Unit price at the time of adding to cart (in the selected currency). The client is responsible for passing the correct discounted price when a campaign is active.
Price per unit after any applicable discount (used as the base for coupon application).
subtotal × quantity. Stored on the cart item for quick order total calculation.ISO 4217 currency code, e.g.
"COP" or "USD".Validation rules
- If
product_variation_idis provided: a cart item for the same(product_id, product_variation_id, user_id)combination must not already exist. - If
product_variation_idisnull: a cart item for the same(product_id, null, user_id)combination must not already exist. quantitymust not exceed the availablestockof the variation (or base product).
Response — success
Response — duplicate item
Response — insufficient stock
PUT /api/ecommerce/cart/
Updates an existing cart item. The same duplicate and stock validations apply as for thePOST endpoint, excluding the current item from the uniqueness check. Throttled to 20 requests per minute.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | The cart item ID returned when the item was created. |
Response
DELETE /api/ecommerce/cart/
Removes a single item from the cart by its UUID. Throttled to 20 requests per minute.Response
DELETE /api/ecommerce/cart/delete_all
Removes all items from the authenticated user’s cart in a single operation.This route is registered before the
cart resource route in routes/api.php, so Laravel correctly matches delete_all as a named path rather than treating it as the {id} wildcard segment.Response
POST /api/ecommerce/cart/apply_cupon
Applies a coupon code to all eligible cart items for the authenticated user. The server resolves which cart items qualify based on the coupon’s scope (product, category, or brand), recalculatessubtotal and total for each matching item, and records the coupon code on those items.
Body
The coupon code to apply, e.g.
"SAVE10". Must match a coupon with state=1.Coupon resolution logic
- The coupon is looked up by
codewithstate=1. If not found →403. - If
type_count=2andnum_use ≤ 0(usage limit exhausted) →403. - If the coupon code is already applied to any item in the cart →
403. - Each cart item is checked against the coupon’s scope:
type_cupone=1— applies to specific products listed incupon.products.type_cupone=2— applies to products belonging to any category listed incupon.categories.type_cupone=3— applies to products from any brand listed incupon.brands.
- For each matching item, the new subtotal is calculated:
type_discount=1(percentage):subtotal = price_unit − price_unit × (discount / 100)type_discount=2(fixed amount):subtotal = price_unit − discounttotal = subtotal × quantity
- The cart item is updated with
type_discount,discount,code_cupon,subtotal,total. Thetype_campaingandcode_discountfields are cleared tonull. - If
type_count=2and at least one item was discounted,cupon.num_useis decremented by 1. - If no cart items matched the coupon’s scope →
403.
Response — success
Response — errors
Cart Item Response Fields
Unique identifier for the cart item, generated as a UUID v4 at creation time.
ID of the authenticated user who owns this cart item.
ID of the product in this cart item.
Embedded product summary containing:
id, title, slug, price_pen, price_usd, imagen, brand_id, brand.ID of the selected variation, or
null for base products.Embedded variation detail including
attribute, propertie, value_add, and variation_father (the parent variation when this is a sub-variation / anidado). null when no variation is selected.Number of units in the cart.
Original unit price at the time the item was added.
Unit price after coupon/discount application. Equals
price_unit when no discount is applied.subtotal × quantity. The line-item total.ISO 4217 currency code, e.g.
"COP" or "USD".Coupon code applied to this item.
null if no coupon has been applied.The discount value applied (either a percentage or a fixed amount).
null if no discount is active.Discount type:
1 = percentage, 2 = fixed amount. null if no discount is active.Campaign type of any applied campaign discount. Cleared to
null when a coupon is applied.Campaign discount code. Cleared to
null when a coupon is applied.Creation timestamp formatted as
"YYYY-MM-DD hh:mm AM/PM".