> ## Documentation Index
> Fetch the complete documentation index at: https://developers.qshop.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Apply Discount to Cart

> **Host**: http://qshop.ng



## OpenAPI

````yaml post /shops/{shopId}/applydiscount/cart/{cartId}
openapi: 3.1.0
info:
  title: OpenAPI Specification
  version: 1.0.0
  description: >-
    QShop storefront API.  This API is used to build a storefront for a QShop
    store
  contact:
    name: QShop
    url: https://qshop.ng
    email: hello@qshop.ng
servers:
  - url: http://staging.qshop.ng/apiv2
    description: Staging server
  - url: http://qshop.ng/api
    description: Production server
security: []
paths:
  /shops/{shopId}/applydiscount/cart/{cartId}:
    post:
      tags:
        - Cart
        - Discount
      summary: Apply Discount to Cart
      description: '**Host**: http://qshop.ng'
      parameters:
        - name: shopId
          in: path
          required: true
          schema:
            type: string
        - name: cartId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                code:
                  type: string
              required:
                - code
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  msg:
                    type: string
                  data:
                    type: object
                    properties:
                      entityId:
                        type: string
                      shop:
                        type: string
                      email:
                        type: 'null'
                      items:
                        type: array
                        items:
                          type: object
                          properties:
                            setAttributesForVariants:
                              type: boolean
                            _id:
                              type: string
                            name:
                              type: string
                            shop:
                              type: string
                            tags:
                              type: array
                              items:
                                type: object
                                properties:
                                  _id:
                                    type: string
                                  name:
                                    type: string
                                  tempId:
                                    type: string
                                  shop:
                                    type: string
                                  __v:
                                    type: integer
                                  slug:
                                    type: string
                                  productCount:
                                    type: integer
                                  imageUrl:
                                    type: string
                                required:
                                  - _id
                                  - name
                                  - tempId
                                  - shop
                                  - __v
                                  - slug
                                  - productCount
                                  - imageUrl
                            costPrice:
                              type: integer
                            price:
                              type: integer
                            sku:
                              type: string
                            sale_price:
                              type: integer
                            stock:
                              type: integer
                            alwaysInStock:
                              type: boolean
                            media:
                              type: string
                            media_type:
                              type: string
                            digital:
                              type: boolean
                            draft:
                              type: boolean
                            type:
                              type: string
                            variantsInheritPrice:
                              type: boolean
                            slug:
                              type: string
                            __v:
                              type: integer
                            qty:
                              type: integer
                            originalPrice:
                              type: integer
                            finalPrice:
                              type: integer
                            subTotal:
                              type: integer
                            downloadCount:
                              type: integer
                            downloadLimit:
                              type: 'null'
                            cartItemId:
                              type: string
                          required:
                            - setAttributesForVariants
                            - _id
                            - name
                            - shop
                            - tags
                            - costPrice
                            - price
                            - sku
                            - sale_price
                            - stock
                            - alwaysInStock
                            - media
                            - media_type
                            - digital
                            - draft
                            - type
                            - variantsInheritPrice
                            - slug
                            - __v
                            - qty
                            - originalPrice
                            - finalPrice
                            - subTotal
                            - downloadCount
                            - downloadLimit
                            - cartItemId
                      subTotal:
                        type: integer
                      total:
                        type: integer
                      created:
                        type: string
                      _id:
                        type: string
                      discountsApplied:
                        type: array
                        items:
                          type: object
                          properties:
                            usageRestriction:
                              type: object
                              properties:
                                roles:
                                  type: object
                                  properties:
                                    exclude:
                                      type: array
                                    accept:
                                      type: array
                                  required:
                                    - exclude
                                    - accept
                                users:
                                  type: object
                                  properties:
                                    condition:
                                      type: string
                                    contains:
                                      type: array
                                  required:
                                    - condition
                                    - contains
                                tags:
                                  type: object
                                  properties:
                                    condition:
                                      type: string
                                    contains:
                                      type: array
                                  required:
                                    - condition
                                    - contains
                                products:
                                  type: object
                                  properties:
                                    condition:
                                      type: string
                                    contains:
                                      type: array
                                  required:
                                    - condition
                                    - contains
                                categories:
                                  type: object
                                  properties:
                                    condition:
                                      type: string
                                    contains:
                                      type: array
                                  required:
                                    - condition
                                    - contains
                              required:
                                - roles
                                - users
                                - tags
                                - products
                                - categories
                            usageLimit:
                              type: object
                              properties:
                                useIfNumberOfOrders:
                                  type: object
                                  properties:
                                    count:
                                      type: 'null'
                                  required:
                                    - count
                                maxNumberOfUses:
                                  type: integer
                                canUseWithOtherCoupons:
                                  type: boolean
                                maxNumberOfUsesPerUser:
                                  type: 'null'
                              required:
                                - useIfNumberOfOrders
                                - maxNumberOfUses
                                - canUseWithOtherCoupons
                                - maxNumberOfUsesPerUser
                            _id:
                              type: string
                            shop:
                              type: string
                            code_type:
                              type: string
                            amount:
                              type: integer
                            min_order:
                              type: 'null'
                            max_order:
                              type: 'null'
                            starts:
                              type: string
                            expires:
                              type: 'null'
                            code:
                              type: string
                            description:
                              type: string
                            usageCount:
                              type: integer
                            applyOn:
                              type: string
                            applyAutomatically:
                              type: boolean
                            created:
                              type: string
                            isActive:
                              type: boolean
                            uuid:
                              type: string
                            mediaType:
                              type: string
                            url:
                              type: string
                            isPublic:
                              type: boolean
                            __v:
                              type: integer
                            worth:
                              type: integer
                          required:
                            - usageRestriction
                            - usageLimit
                            - _id
                            - shop
                            - code_type
                            - amount
                            - min_order
                            - max_order
                            - starts
                            - expires
                            - code
                            - description
                            - usageCount
                            - applyOn
                            - applyAutomatically
                            - created
                            - isActive
                            - uuid
                            - mediaType
                            - url
                            - isPublic
                            - __v
                            - worth
                      discountAmount:
                        type: integer
                      shipping:
                        type: integer
                      shippingRate:
                        type: object
                      user:
                        type: string
                      exclusiveDiscount:
                        type: boolean
                      order:
                        type: 'null'
                    required:
                      - entityId
                      - shop
                      - email
                      - items
                      - subTotal
                      - total
                      - created
                      - _id
                      - discountsApplied
                      - discountAmount
                      - shipping
                      - shippingRate
                      - user
                      - exclusiveDiscount
                      - order
                  success:
                    type: boolean
                required:
                  - msg
                  - data
                  - success
          description: ''

````