Files
medusa-store/www/apps/docs/content/references/services/classes/DiscountCondition.mdx
github-actions[bot] 39649b3552 chore(docs): Generated References (#5602)
Generated the following references:
- `pricing`
- `product`

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
2023-11-10 17:31:02 +00:00

171 lines
4.5 KiB
Plaintext

---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# DiscountCondition
Holds rule conditions for when a discount is applicable
## Constructors
### constructor
**new DiscountCondition**()
Holds rule conditions for when a discount is applicable
## Properties
<ParameterTypes parameters={[
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "customer_groups",
"type": "[`CustomerGroup`](CustomerGroup.mdx)[]",
"description": "Customer groups associated with this condition if `type` is `customer_groups`.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "deleted_at",
"type": "``null`` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "discount_rule",
"type": "[`DiscountRule`](DiscountRule.mdx)",
"description": "The details of the discount rule associated with the condition.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "discount_rule_id",
"type": "`string`",
"description": "The ID of the discount rule associated with the condition",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The discount condition's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "Record<`string`, `unknown`\\>",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "operator",
"type": "[`DiscountConditionOperator`](../enums/DiscountConditionOperator.mdx)",
"description": "The operator of the condition. `in` indicates that discountable resources are within the specified resources. `not_in` indicates that discountable resources are everything but the specified resources.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "product_collections",
"type": "[`ProductCollection`](ProductCollection.mdx)[]",
"description": "Product collections associated with this condition if `type` is `product_collections`.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "product_tags",
"type": "[`ProductTag`](ProductTag.mdx)[]",
"description": "Product tags associated with this condition if `type` is `product_tags`.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "product_types",
"type": "[`ProductType`](ProductType.mdx)[]",
"description": "Product types associated with this condition if `type` is `product_types`.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "products",
"type": "[`Product`](Product.mdx)[]",
"description": "products associated with this condition if `type` is `products`.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "type",
"type": "[`DiscountConditionType`](../enums/DiscountConditionType.mdx)",
"description": "The type of the condition. The type affects the available resources associated with the condition. For example, if the type is `products`, that means the `products` relation will hold the products associated with this condition and other relations will be empty.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
## Methods
### beforeInsert
`Private` **beforeInsert**(): `void`
#### Returns
`void`
<ParameterTypes parameters={[
{
"name": "void",
"type": "`void`",
"optional": true,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />