docs: add section on retrieve totals for cart items and shipping methods in storefront (#13513)

* docs: add section on retrieve totals for cart items and shipping methods in storefront

* change return type

* update OAS
This commit is contained in:
Shahed Nasser authored and GitHub committed 2025-09-15 19:11:17 +03:00
1 parent 88748ba09d
commit 8c21243f42
12 files changed
+387 -200

No files matched your search

@@ -5,17 +5,6 @@ required:
- cart
- title
- id
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- requires_shipping
- is_discountable
- is_tax_inclusive
@@ -298,44 +287,88 @@ properties:
original_total:
type: number
title: original_total
description: The item's total including taxes, excluding promotions.
description: >-
The item's total including taxes, excluding promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
original_subtotal:
type: number
title: original_subtotal
description: The item's total excluding taxes, including promotions.
description: >-
The item's total excluding taxes, including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
original_tax_total:
type: number
title: original_tax_total
description: The total taxes of the item excluding promotions.
description: >-
The total taxes of the item excluding promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
item_total:
type: number
title: original_tax_total
description: The item's total including taxes and promotions.
description: >-
The item's total including taxes and promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
item_subtotal:
type: number
title: item_subtotal
description: The item's total excluding taxes, including promotions.
description: >-
The item's total excluding taxes, including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
item_tax_total:
type: number
title: item_tax_total
description: The total taxes of the item including promotions.
description: >-
The total taxes of the item including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
total:
type: number
title: total
description: The item's total including taxes and promotions.
description: >-
The item's total including taxes and promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
subtotal:
type: number
title: subtotal
description: The item's total excluding taxes, including promotions.
description: >-
The item's total excluding taxes, including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
tax_total:
type: number
title: tax_total
description: The total taxes of the item including promotions.
description: >-
The total taxes of the item including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
discount_total:
type: number
title: discount_total
description: The total discount of the item.
description: >-
The total discount of the item. This field is only available if you expand
the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
discount_tax_total:
type: number
title: discount_tax_total
description: The total taxes applied on the discounted amount.
description: >-
The total taxes applied on the discounted amount. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
@@ -9,14 +9,6 @@ required:
- is_tax_inclusive
- created_at
- updated_at
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
properties:
id:
type: string
@@ -221,36 +213,70 @@ properties:
original_total:
type: number
title: original_total
description: The shipping method's total including taxes, excluding promotions.
description: >-
The shipping method's total including taxes, excluding promotions. This
field is only available if you expand the `shipping_methods.*` relation.
Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
original_subtotal:
type: number
title: original_subtotal
description: The shipping method's total excluding taxes, including promotions.
description: >-
The shipping method's total excluding taxes, including promotions. This
field is only available if you expand the `shipping_methods.*` relation.
Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
original_tax_total:
type: number
title: original_tax_total
description: >-
The total taxes applied on the shipping method's amount including
promotions.
promotions. This field is only available if you expand the
`shipping_methods.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
total:
type: number
title: total
description: The shipping method's total amount including taxes and promotions.
description: >-
The shipping method's total amount including taxes and promotions. This
field is only available if you expand the `shipping_methods.*` relation.
Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
subtotal:
type: number
title: subtotal
description: The shipping method's total amount excluding taxes, including promotions.
description: >-
The shipping method's total amount excluding taxes, including promotions.
This field is only available if you expand the `shipping_methods.*`
relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
tax_total:
type: number
title: tax_total
description: >-
The total taxes applied on the shipping method's amount including
promotions.
promotions. This field is only available if you expand the
`shipping_methods.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
discount_total:
type: number
title: discount_total
description: The total amount discounted.
description: >-
The total amount discounted. This field is only available if you expand
the `shipping_methods.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
discount_tax_total:
type: number
title: discount_tax_total
description: The taxes applied on the discounted amount.
description: >-
The taxes applied on the discounted amount. This field is only available
if you expand the `shipping_methods.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
@@ -76258,17 +76258,6 @@ components:
- cart
- title
- id
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- requires_shipping
- is_discountable
- is_tax_inclusive
@@ -76551,47 +76540,47 @@ components:
original_total:
type: number
title: original_total
description: The item's total including taxes, excluding promotions.
description: The item's total including taxes, excluding promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
original_subtotal:
type: number
title: original_subtotal
description: The item's total excluding taxes, including promotions.
description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
original_tax_total:
type: number
title: original_tax_total
description: The total taxes of the item excluding promotions.
description: The total taxes of the item excluding promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
item_total:
type: number
title: original_tax_total
description: The item's total including taxes and promotions.
description: The item's total including taxes and promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
item_subtotal:
type: number
title: item_subtotal
description: The item's total excluding taxes, including promotions.
description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
item_tax_total:
type: number
title: item_tax_total
description: The total taxes of the item including promotions.
description: The total taxes of the item including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
total:
type: number
title: total
description: The item's total including taxes and promotions.
description: The item's total including taxes and promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
subtotal:
type: number
title: subtotal
description: The item's total excluding taxes, including promotions.
description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
tax_total:
type: number
title: tax_total
description: The total taxes of the item including promotions.
description: The total taxes of the item including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
discount_total:
type: number
title: discount_total
description: The total discount of the item.
description: The total discount of the item. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
discount_tax_total:
type: number
title: discount_tax_total
description: The total taxes applied on the discounted amount.
description: The total taxes applied on the discounted amount. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
StoreCartPromotion:
type: object
description: The promotion's promotions.
@@ -76668,14 +76657,6 @@ components:
- is_tax_inclusive
- created_at
- updated_at
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
properties:
id:
type: string
@@ -76877,35 +76858,35 @@ components:
original_total:
type: number
title: original_total
description: The shipping method's total including taxes, excluding promotions.
description: The shipping method's total including taxes, excluding promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
original_subtotal:
type: number
title: original_subtotal
description: The shipping method's total excluding taxes, including promotions.
description: The shipping method's total excluding taxes, including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
original_tax_total:
type: number
title: original_tax_total
description: The total taxes applied on the shipping method's amount including promotions.
description: The total taxes applied on the shipping method's amount including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
total:
type: number
title: total
description: The shipping method's total amount including taxes and promotions.
description: The shipping method's total amount including taxes and promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
subtotal:
type: number
title: subtotal
description: The shipping method's total amount excluding taxes, including promotions.
description: The shipping method's total amount excluding taxes, including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
tax_total:
type: number
title: tax_total
description: The total taxes applied on the shipping method's amount including promotions.
description: The total taxes applied on the shipping method's amount including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
discount_total:
type: number
title: discount_total
description: The total amount discounted.
description: The total amount discounted. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
discount_tax_total:
type: number
title: discount_tax_total
description: The taxes applied on the discounted amount.
description: The taxes applied on the discounted amount. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
StoreCartShippingOption:
type: object
description: The shipping option's details.
@@ -5,17 +5,6 @@ required:
- cart
- title
- id
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- requires_shipping
- is_discountable
- is_tax_inclusive
@@ -298,44 +287,88 @@ properties:
original_total:
type: number
title: original_total
description: The item's total including taxes, excluding promotions.
description: >-
The item's total including taxes, excluding promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
original_subtotal:
type: number
title: original_subtotal
description: The item's total excluding taxes, including promotions.
description: >-
The item's total excluding taxes, including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
original_tax_total:
type: number
title: original_tax_total
description: The total taxes of the item excluding promotions.
description: >-
The total taxes of the item excluding promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
item_total:
type: number
title: original_tax_total
description: The item's total including taxes and promotions.
description: >-
The item's total including taxes and promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
item_subtotal:
type: number
title: item_subtotal
description: The item's total excluding taxes, including promotions.
description: >-
The item's total excluding taxes, including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
item_tax_total:
type: number
title: item_tax_total
description: The total taxes of the item including promotions.
description: >-
The total taxes of the item including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
total:
type: number
title: total
description: The item's total including taxes and promotions.
description: >-
The item's total including taxes and promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
subtotal:
type: number
title: subtotal
description: The item's total excluding taxes, including promotions.
description: >-
The item's total excluding taxes, including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
tax_total:
type: number
title: tax_total
description: The total taxes of the item including promotions.
description: >-
The total taxes of the item including promotions. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
discount_total:
type: number
title: discount_total
description: The total discount of the item.
description: >-
The total discount of the item. This field is only available if you expand
the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
discount_tax_total:
type: number
title: discount_tax_total
description: The total taxes applied on the discounted amount.
description: >-
The total taxes applied on the discounted amount. This field is only
available if you expand the `items.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals)
guide.
@@ -9,14 +9,6 @@ required:
- is_tax_inclusive
- created_at
- updated_at
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
properties:
id:
type: string
@@ -221,36 +213,70 @@ properties:
original_total:
type: number
title: original_total
description: The shipping method's total including taxes, excluding promotions.
description: >-
The shipping method's total including taxes, excluding promotions. This
field is only available if you expand the `shipping_methods.*` relation.
Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
original_subtotal:
type: number
title: original_subtotal
description: The shipping method's total excluding taxes, including promotions.
description: >-
The shipping method's total excluding taxes, including promotions. This
field is only available if you expand the `shipping_methods.*` relation.
Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
original_tax_total:
type: number
title: original_tax_total
description: >-
The total taxes applied on the shipping method's amount including
promotions.
promotions. This field is only available if you expand the
`shipping_methods.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
total:
type: number
title: total
description: The shipping method's total amount including taxes and promotions.
description: >-
The shipping method's total amount including taxes and promotions. This
field is only available if you expand the `shipping_methods.*` relation.
Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
subtotal:
type: number
title: subtotal
description: The shipping method's total amount excluding taxes, including promotions.
description: >-
The shipping method's total amount excluding taxes, including promotions.
This field is only available if you expand the `shipping_methods.*`
relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
tax_total:
type: number
title: tax_total
description: >-
The total taxes applied on the shipping method's amount including
promotions.
promotions. This field is only available if you expand the
`shipping_methods.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
discount_total:
type: number
title: discount_total
description: The total amount discounted.
description: >-
The total amount discounted. This field is only available if you expand
the `shipping_methods.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
discount_tax_total:
type: number
title: discount_tax_total
description: The taxes applied on the discounted amount.
description: >-
The taxes applied on the discounted amount. This field is only available
if you expand the `shipping_methods.*` relation. Learn more in the [Cart
Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals)
guide.
@@ -30519,17 +30519,6 @@ components:
- cart
- title
- id
- item_total
- item_subtotal
- item_tax_total
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
- requires_shipping
- is_discountable
- is_tax_inclusive
@@ -30812,47 +30801,47 @@ components:
original_total:
type: number
title: original_total
description: The item's total including taxes, excluding promotions.
description: The item's total including taxes, excluding promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
original_subtotal:
type: number
title: original_subtotal
description: The item's total excluding taxes, including promotions.
description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
original_tax_total:
type: number
title: original_tax_total
description: The total taxes of the item excluding promotions.
description: The total taxes of the item excluding promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
item_total:
type: number
title: original_tax_total
description: The item's total including taxes and promotions.
description: The item's total including taxes and promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
item_subtotal:
type: number
title: item_subtotal
description: The item's total excluding taxes, including promotions.
description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
item_tax_total:
type: number
title: item_tax_total
description: The total taxes of the item including promotions.
description: The total taxes of the item including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
total:
type: number
title: total
description: The item's total including taxes and promotions.
description: The item's total including taxes and promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
subtotal:
type: number
title: subtotal
description: The item's total excluding taxes, including promotions.
description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
tax_total:
type: number
title: tax_total
description: The total taxes of the item including promotions.
description: The total taxes of the item including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
discount_total:
type: number
title: discount_total
description: The total discount of the item.
description: The total discount of the item. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
discount_tax_total:
type: number
title: discount_tax_total
description: The total taxes applied on the discounted amount.
description: The total taxes applied on the discounted amount. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
StoreCartPromotion:
type: object
description: The promotion's promotions.
@@ -30929,14 +30918,6 @@ components:
- is_tax_inclusive
- created_at
- updated_at
- original_total
- original_subtotal
- original_tax_total
- total
- subtotal
- tax_total
- discount_total
- discount_tax_total
properties:
id:
type: string
@@ -31138,35 +31119,35 @@ components:
original_total:
type: number
title: original_total
description: The shipping method's total including taxes, excluding promotions.
description: The shipping method's total including taxes, excluding promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
original_subtotal:
type: number
title: original_subtotal
description: The shipping method's total excluding taxes, including promotions.
description: The shipping method's total excluding taxes, including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
original_tax_total:
type: number
title: original_tax_total
description: The total taxes applied on the shipping method's amount including promotions.
description: The total taxes applied on the shipping method's amount including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
total:
type: number
title: total
description: The shipping method's total amount including taxes and promotions.
description: The shipping method's total amount including taxes and promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
subtotal:
type: number
title: subtotal
description: The shipping method's total amount excluding taxes, including promotions.
description: The shipping method's total amount excluding taxes, including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
tax_total:
type: number
title: tax_total
description: The total taxes applied on the shipping method's amount including promotions.
description: The total taxes applied on the shipping method's amount including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
discount_total:
type: number
title: discount_total
description: The total amount discounted.
description: The total amount discounted. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
discount_tax_total:
type: number
title: discount_tax_total
description: The taxes applied on the discounted amount.
description: The taxes applied on the discounted amount. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
StoreCartShippingOption:
type: object
description: The shipping option's details.
+3 -3
View File
@@ -24479,7 +24479,7 @@ The basic authentication flow requires first using the `register` method, then t
const {
success,
authIdentity,
error
error,
} = await authModuleService.register(
"emailpass",
// passed to auth provider
@@ -24527,7 +24527,7 @@ There are two ways to handle this:
const {
success,
authIdentity,
location
location,
} = await authModuleService.authenticate(
"emailpass",
// passed to auth provider
@@ -24600,7 +24600,7 @@ The Google and GitHub providers allow you to override their `callbackUrl` option
const {
success,
authIdentity,
location
location,
} = await authModuleService.authenticate(
"google",
// passed to auth provider
@@ -90,7 +90,7 @@ The basic authentication flow requires first using the `register` method, then t
const {
success,
authIdentity,
error
error,
} = await authModuleService.register(
"emailpass",
// passed to auth provider
@@ -142,7 +142,7 @@ There are two ways to handle this:
const {
success,
authIdentity,
location
location,
} = await authModuleService.authenticate(
"emailpass",
// passed to auth provider
@@ -215,7 +215,7 @@ The Google and GitHub providers allow you to override their `callbackUrl` option
const {
success,
authIdentity,
location
location,
} = await authModuleService.authenticate(
"google",
// passed to auth provider
@@ -35,7 +35,7 @@ The fields that are most commonly used are:
`subtotal`
</Table.Cell>
<Table.Cell>
The cart's subtotal excluding taxes, and including total of items, shipping, and discounts.
The cart's subtotal excluding taxes and including items, shipping, and discounts.
</Table.Cell>
</Table.Row>
<Table.Row>
@@ -75,7 +75,7 @@ The fields that are most commonly used are:
---
## Example: React Storefront
## Example: Show Cart Totals in React Storefront
Here's an example of how you can show the cart totals in a React component:
@@ -106,7 +106,7 @@ export default function CartTotals() {
const formatPrice = (amount: number): string => {
return new Intl.NumberFormat("en-US", {
style: "currency",
currency: cart?.currency_code,
currency: cart?.currency_code || "USD",
})
.format(amount)
}
@@ -146,3 +146,129 @@ export default function CartTotals() {
In the example, you first retrieve the cart using the [Cart Context](../context/page.mdx). Then, you define the [formatPrice](../retrieve/page.mdx#format-prices) function to format the total amounts.
Finally, you render the cart totals in a list, showing the subtotal, discounts, shipping, taxes, and the total amount.
---
## Retrieve and Show Cart Item Totals
You can also show the totals specific to each item in the cart. This is useful when you want to show the price breakdown for each item, such as price before and after discounts.
The cart item totals aren't included by default in the cart object. You need to explicitly expand the `items.*` relation when retrieving the cart. This will add item totals like `total`, `subtotal`, `tax_total`, and `discount_total` to each item object in the cart. You can learn about other total fields in the [Store API reference](!api!/store#carts_cart_schema).
For example, when retrieving the cart, you can expand the `items.*` relation like this:
```ts
sdk.store.cart.retrieve(cartId, {
fields: "+items.*",
// TIP: You can also expand both items and shipping methods at the same time
// fields: "+items.*, +shipping_methods.*",
})
.then(({ cart: dataCart }) => {
setCart(dataCart)
})
```
Then, you can show the item totals in a React component like this:
```tsx
"use client" // include with Next.js 13+
import { HttpTypes } from "@medusajs/types"
type CartItemTotalsProps = {
cart: HttpTypes.StoreCart
}
export default function CartItemTotals({
cart,
}: CartItemTotalsProps) {
const formatPrice = (amount: number): string => {
return new Intl.NumberFormat("en-US", {
style: "currency",
currency: cart.currency_code,
})
.format(amount)
}
return (
<ul>
{cart.items.map((item) => (
<li key={item.id}>
<span>{item.title}</span>
<span>{formatPrice(item.total!)}</span>
<span>(Subtotal: {formatPrice(item.subtotal!)})</span>
<span>(Discounts: {formatPrice(item.discount_total!)})</span>
<span>(Taxes: {formatPrice(item.tax_total!)})</span>
</li>
))}
</ul>
)
}
```
In the example, you receive the cart with the expanded item totals as a prop. Then, you define the [formatPrice](../retrieve/page.mdx#format-prices) function to format the total amounts.
Finally, you render the cart items in a list, showing each item's title, total, subtotal, discounts, and taxes.
---
## Retrieve and Show Shipping Method Totals
You can also show the totals specific to each shipping method in the cart. This is useful when you want to show the price breakdown for each shipping method, such as price before and after discounts.
The cart shipping method totals aren't included by default in the cart response. You need to explicitly expand the `shipping_methods.*` relation when retrieving the cart. This will add shipping method totals like `total`, `subtotal`, `tax_total`, and `discount_total` to each shipping method object in the cart. You can learn about other total fields in the [Store API reference](!api!/store#carts_cart_schema).
For example, when retrieving the cart, you can expand the `shipping_methods.*` relation like this:
```ts
sdk.store.cart.retrieve(cartId, {
fields: "+shipping_methods.*",
// TIP: You can also expand both items and shipping methods at the same time
// fields: "+items.*, +shipping_methods.*",
})
.then(({ cart: dataCart }) => {
setCart(dataCart)
})
```
Then, you can show the shipping method totals in a React component like this:
```tsx
"use client" // include with Next.js 13+
import { HttpTypes } from "@medusajs/types"
type CartShippingMethodTotalsProps = {
cart: HttpTypes.StoreCart
}
export default function CartShippingMethodTotals({
cart,
}: CartShippingMethodTotalsProps) {
const formatPrice = (amount: number): string => {
return new Intl.NumberFormat("en-US", {
style: "currency",
currency: cart.currency_code,
})
.format(amount)
}
return (
<ul>
{cart.shipping_methods.map((method) => (
<li key={method.id}>
<span>{method.name}</span>
<span>{formatPrice(method.total!)}</span>
<span>(Subtotal: {formatPrice(method.subtotal!)})</span>
<span>(Discounts: {formatPrice(method.discount_total!)})</span>
<span>(Taxes: {formatPrice(method.tax_total!)})</span>
</li>
))}
</ul>
)
}
```
In the example, you receive the cart with the expanded shipping method totals as a prop. Then, you define the [formatPrice](../retrieve/page.mdx#format-prices) function to format the total amounts.
Finally, you render the cart shipping methods in a list, showing each method's name, total, subtotal, discounts, and taxes.
+1 -1
View File
@@ -6035,7 +6035,7 @@ export const generatedEditDates = {
"references/modules/notification_service/page.mdx": "2025-03-17T15:24:05.164Z",
"references/notification_service/interfaces/notification_service.INotificationModuleService/page.mdx": "2025-07-24T08:20:50.610Z",
"app/nextjs-starter/guides/revalidate-cache/page.mdx": "2025-05-01T15:33:42.490Z",
"app/storefront-development/cart/totals/page.mdx": "2025-08-14T15:58:30.316Z",
"app/storefront-development/cart/totals/page.mdx": "2025-09-15T15:13:56.268Z",
"app/storefront-development/checkout/order-confirmation/page.mdx": "2025-08-14T15:58:36.610Z",
"app/how-to-tutorials/tutorials/product-reviews/page.mdx": "2025-06-26T12:34:50.976Z",
"app/troubleshooting/data-models/default-fields/page.mdx": "2025-03-21T06:59:06.775Z",
@@ -7,17 +7,6 @@
* - cart
* - title
* - id
* - item_total
* - item_subtotal
* - item_tax_total
* - original_total
* - original_subtotal
* - original_tax_total
* - total
* - subtotal
* - tax_total
* - discount_total
* - discount_tax_total
* - requires_shipping
* - is_discountable
* - is_tax_inclusive
@@ -300,47 +289,47 @@
* original_total:
* type: number
* title: original_total
* description: The item's total including taxes, excluding promotions.
* description: The item's total including taxes, excluding promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* original_subtotal:
* type: number
* title: original_subtotal
* description: The item's total excluding taxes, including promotions.
* description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* original_tax_total:
* type: number
* title: original_tax_total
* description: The total taxes of the item excluding promotions.
* description: The total taxes of the item excluding promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* item_total:
* type: number
* title: original_tax_total
* description: The item's total including taxes and promotions.
* description: The item's total including taxes and promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* item_subtotal:
* type: number
* title: item_subtotal
* description: The item's total excluding taxes, including promotions.
* description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* item_tax_total:
* type: number
* title: item_tax_total
* description: The total taxes of the item including promotions.
* description: The total taxes of the item including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* total:
* type: number
* title: total
* description: The item's total including taxes and promotions.
* description: The item's total including taxes and promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* subtotal:
* type: number
* title: subtotal
* description: The item's total excluding taxes, including promotions.
* description: The item's total excluding taxes, including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* tax_total:
* type: number
* title: tax_total
* description: The total taxes of the item including promotions.
* description: The total taxes of the item including promotions. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* discount_total:
* type: number
* title: discount_total
* description: The total discount of the item.
* description: The total discount of the item. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
* discount_tax_total:
* type: number
* title: discount_tax_total
* description: The total taxes applied on the discounted amount.
* description: The total taxes applied on the discounted amount. This field is only available if you expand the `items.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-cart-item-totals) guide.
*
*/
@@ -11,14 +11,6 @@
* - is_tax_inclusive
* - created_at
* - updated_at
* - original_total
* - original_subtotal
* - original_tax_total
* - total
* - subtotal
* - tax_total
* - discount_total
* - discount_tax_total
* properties:
* id:
* type: string
@@ -220,35 +212,35 @@
* original_total:
* type: number
* title: original_total
* description: The shipping method's total including taxes, excluding promotions.
* description: The shipping method's total including taxes, excluding promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
* original_subtotal:
* type: number
* title: original_subtotal
* description: The shipping method's total excluding taxes, including promotions.
* description: The shipping method's total excluding taxes, including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
* original_tax_total:
* type: number
* title: original_tax_total
* description: The total taxes applied on the shipping method's amount including promotions.
* description: The total taxes applied on the shipping method's amount including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
* total:
* type: number
* title: total
* description: The shipping method's total amount including taxes and promotions.
* description: The shipping method's total amount including taxes and promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
* subtotal:
* type: number
* title: subtotal
* description: The shipping method's total amount excluding taxes, including promotions.
* description: The shipping method's total amount excluding taxes, including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
* tax_total:
* type: number
* title: tax_total
* description: The total taxes applied on the shipping method's amount including promotions.
* description: The total taxes applied on the shipping method's amount including promotions. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
* discount_total:
* type: number
* title: discount_total
* description: The total amount discounted.
* description: The total amount discounted. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
* discount_tax_total:
* type: number
* title: discount_tax_total
* description: The taxes applied on the discounted amount.
* description: The taxes applied on the discounted amount. This field is only available if you expand the `shipping_methods.*` relation. Learn more in the [Cart Totals](https://docs.medusajs.com/resources/storefront-development/cart/totals#retrieve-and-show-shipping-method-totals) guide.
*
*/