Typescript SDK Type Docs
    Preparing search index...

    Interface CartAddDiscountCodeAction

    Adds a DiscountCode to the Cart to activate the related Cart Discounts. If the related Cart Discounts are inactive or invalid, or belong to a different Store than the Cart, a DiscountCodeNonApplicableError is returned.

    A Discount Code can be added only if no [DirectDiscount](ctp:api:type:DirectDiscount) has been applied to the Cart.
    For [frozen Carts](ctp:api:type:FrozenCarts), the [DiscountCodeState](ctp:api:type:DiscountCodeState) must be `DoesNotMatchCart` when adding a Discount Code.
    
    The maximum number of Discount Codes in a Cart is restricted by a [limit](/../api/limits#carts).
    
    Specific Error Code: [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError)
    
    interface CartAddDiscountCodeAction {
        action: "addDiscountCode";
        code: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    Properties

    action: "addDiscountCode"
    code: string

    code of a DiscountCode.