You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/discounts/discounts_api.md
+11-9Lines changed: 11 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -45,8 +45,6 @@ The following discount rule types are available:
45
45
46
46
Only a single discount can be applied to a given product, and a discount can only have a single rule.
47
47
48
-
You can create your own rules by creating a class implementing the [DiscountRuleInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-DiscountRuleInterface.html) interface.
49
-
50
48
### Conditions
51
49
52
50
With conditions you can narrow down the scenarios in which the discount applies. The following conditions are available:
@@ -64,19 +62,23 @@ With conditions you can narrow down the scenarios in which the discount applies.
64
62
65
63
When multiple conditions are specified, all of them must be met.
66
64
67
-
You can create your own conditions by creating a class implementing the [DiscountConditionInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-DiscountConditionInterface.html) interface.
68
-
69
65
### Priority
70
66
71
67
You can set discount priority as a number between 1 and 10 to indicate which discount should have [higher priority](discounts_guide.md#discounts-priority) when choosing the one to apply.
72
68
73
69
### Start and end date
74
70
75
-
Discounts can be permanent, or valid only in specified time frame.
71
+
Discounts can be permanent, or valid only in a specified time frame.
76
72
77
73
Every discount has a start date, which defaults to the date when the discount was created.
78
74
The end date can be set to `null` to make the discount permanent.
79
75
76
+
### Status
77
+
78
+
You can disable a discount anytime to stop it from being active, even if the conditions enforced by start and end date are met.
79
+
80
+
Only disabled discounts can be deleted.
81
+
80
82
### Discount translations
81
83
82
84
The discount has four properties that can be translated:
@@ -112,15 +114,15 @@ The example below contains a Command creating a cart discount. The discount:
112
114
- applies to 2 products
113
115
- requires a `summer10` discount code to be activated. The code can be used unlimited number of times
Similarly, use the `deleteDiscount`, `deleteTranslation`, `disableDiscount`, `enableDiscount`, and `updateDiscount` methods from the [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) to manage the discounts. You can always attach additional logic to the Discounts API by listening to the available events.
121
+
Similarly, use the `deleteDiscount`, `deleteTranslation`, `disableDiscount`, `enableDiscount`, and `updateDiscount` methods from the [DiscountServiceInterface](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html) to manage the discounts. You can always attach additional logic to the Discounts API by listening to the [available events](discounts_events.md).
120
122
121
123
## Search
122
124
123
-
You can search for Discounts using the [`DiscountServiceInterface::findDiscounts()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html#method_findDiscounts) method.
124
-
To learn more about the available search options, see Discounts' Search Criteria and Sort Clauses.
125
+
You can search for Discounts using the [`DiscountServiceInterface::findDiscounts()](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-DiscountServiceInterface.html#method_findDiscounts) method.
126
+
To learn more about the available search options, see Discounts' [Search Criteria](discounts_criteria.md) and [Sort Clauses](discounts_sort_clauses.md).
125
127
126
128
For discount codes, you can query the database for discount code usage using [`DiscountCodeServiceInterface::findCodeUsages()`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-DiscountsCodes-DiscountCodeServiceInterface.html#method_findCodeUsages) and [`DiscountCodeUsageQuery`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-DiscountsCodes-Value-Query-DiscountCodeUsageQuery.html).
0 commit comments