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/extend_discounts.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ For both of them, you need to specify their logic with [Symfony's expression lan
29
29
You can use the following built-in expressions (variables and functions) in your own custom conditions and rules.
30
30
You can also [create your own](#custom-expressions).
31
31
32
-
| Type | Name | Value | Available for |
32
+
| Type | Name | Value | Available for |
33
33
| --- | --- | --- | --- |
34
34
| Function |`get_current_region()`|[Region object](/api/php_api/php_api_reference/classes/Ibexa-Contracts-ProductCatalog-Values-RegionInterface.html) of the current siteaccess.| Conditions, rules |
35
35
| Function |`is_in_category()`|`true/false`, depending if a product belongs to given [product categories](pim_guide.md#product-categories).| Conditions, rules |
@@ -116,12 +116,12 @@ This condition can be used in both catalog and cart discounts.
116
116
To implement a cart-only discount, additionally implement the marker [`CartDiscountConditionInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-CartDiscountConditionInterface.html) interface.
117
117
118
118
The `tolerance` option is made available for usage in the expression by passing it in the constructor.
119
-
The `getExpression` method contains the logic of the condition, expressed using the variables and functions available in the expression engine.
119
+
The `getExpression()` method contains the logic of the condition, expressed using the variables and functions available in the expression engine.
120
120
The expression must evaluate to `true` or `false`, indicating whether the condition is met.
121
121
122
122
The example uses three expressions:
123
123
124
-
- the custom `is_anniversary` function, returning a value indicating whether today is user's registration anniversary
124
+
- the custom `is_anniversary()` function, returning a value indicating whether today is user's registration anniversary
125
125
- the custom `current_user_registration_date` variable, holding the value of current user's registration date
126
126
- the custom `tolerance` variable, holding the acceptable tolerance (in days) for the calculation
127
127
@@ -157,7 +157,7 @@ To learn how to integrate it into the back office, see [Extend Discounts wizard]
157
157
158
158
### Implement custom rules
159
159
160
-
The following example implements a [purchasing power parity](https://en.wikipedia.org/wiki/Purchasing_power_parity) discount, adjusting product's price in the cart based on buyer's region.
160
+
The following example implements a [purchasing power parity](https://en.wikipedia.org/wiki/Purchasing_power_parity) discount, adjusting product's price in the cart based on buyer's region.
161
161
You could use it, for example, in regions sharing the same currency and apply the rule only to them by using the [`IsInRegions` condition](discounts_api.md#conditions).
162
162
163
163
To implement a custom rule, create a class implementing the [`DiscountRuleInterface`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Discounts-Value-DiscountRuleInterface.html).
@@ -166,7 +166,7 @@ To implement a custom rule, create a class implementing the [`DiscountRuleInterf
0 commit comments