Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
5.9 KiB
displayed_sidebar
| displayed_sidebar |
|---|
| jsClientSidebar |
Class: AdminPostDiscountsReq
internal.AdminPostDiscountsReq
Schema
AdminPostDiscountsReq type: object required:
- code
- rule
- regions
properties:
code:
type: string
description: A unique code that will be used to redeem the discount
is_dynamic:
type: boolean
description: Whether the discount should have multiple instances of itself, each with a different code. This can be useful for automatically generated discount codes that all have to follow a common set of rules.
default: false
rule:
description: The discount rule that defines how discounts are calculated
type: object
required:
- type
- value
- allocation
properties:
description:
type: string
description: "A short description of the discount"
type:
type: string
description: "The type of the discount, can be
fixedfor discounts that reduce the price by a fixed amount,percentagefor percentage reductions orfree_shippingfor shipping vouchers." enum: [fixed, percentage, free_shipping] value: type: number description: "The value that the discount represents. This will depend on the type of the discount." allocation: type: string description: "The scope that the discount should apply to.totalindicates that the discount should be applied on the cart total, anditemindicates that the discount should be applied to each discountable item in the cart." enum: [total, item] conditions: type: array description: "A set of conditions that can be used to limit when the discount can be used. Only one ofproducts,product_types,product_collections,product_tags, andcustomer_groupsshould be provided based on the discount condition's type." items: type: object required: - operator properties: operator: type: string description: "Operator of the condition.inindicates that discountable resources are within the specified resources.not_inindicates that discountable resources are everything but the specified resources." enum: [in, not_in] products: type: array description: list of product IDs if the condition's type isproducts. items: type: string product_types: type: array description: list of product type IDs if the condition's type isproduct_types. items: type: string product_collections: type: array description: list of product collection IDs if the condition's type isproduct_collections. items: type: string product_tags: type: array description: list of product tag IDs if the condition's type isproduct_tags. items: type: string customer_groups: type: array description: list of customer group IDs if the condition's type iscustomer_groups. items: type: string is_disabled: type: boolean description: Whether the discount code is disabled on creation. If set totrue, it will not be available for customers. default: false starts_at: type: string format: date-time description: The date and time at which the discount should be available. ends_at: type: string format: date-time description: The date and time at which the discount should no longer be available. valid_duration: type: string description: The duration the discount runs between example: P3Y6M4DT12H30M5S regions: description: A list of region IDs representing the Regions in which the Discount can be used. type: array items: type: string usage_limit: type: number description: Maximum number of times the discount can be used metadata: description: An optional set of key-value pairs to hold additional information. type: object externalDocs: description: "Learn about the metadata attribute, and how to delete and update it." url: "https://docs.medusajs.com/development/entities/overview#metadata-attribute"
Properties
code
• code: string
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:194
ends_at
• Optional ends_at: Date
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:199
is_disabled
• is_disabled: boolean
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:197
is_dynamic
• is_dynamic: boolean
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:196
metadata
• Optional metadata: Record<string, unknown>
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:203
regions
• regions: string[]
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:202
rule
• rule: AdminPostDiscountsDiscountRule
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:195
starts_at
• Optional starts_at: Date
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:198
usage_limit
• Optional usage_limit: number
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:201
valid_duration
• Optional valid_duration: string
Defined in
packages/medusa/dist/api/routes/admin/discounts/create-discount.d.ts:200