File tree Expand file tree Collapse file tree 3 files changed +81
-0
lines changed
code_samples/data_migration/examples/discounts
docs/content_management/data_migration Expand file tree Collapse file tree 3 files changed +81
-0
lines changed Original file line number Diff line number Diff line change
1
+ - type : discount
2
+ mode : create
3
+ identifier : summer_sale_2025
4
+ translations :
5
+ -
6
+ language_code : eng-GB
7
+ name : " Summer Sale 2025"
8
+ description : " -10% on laptops"
9
+ label : " HOT DEAL: Summer Sale!"
10
+ label_description : " Get 10% off on selected items!"
11
+ discount_type : cart
12
+ priority : 8
13
+ enabled : true
14
+ user : admin
15
+ startDate : ' 2024-01-01T00:01:00+00:00'
16
+ endDate : null
17
+ createdAt : null
18
+ updatedAt : null
19
+ rule :
20
+ type : percentage
21
+ expressionValues :
22
+ discount_percentage : 10
23
+ conditions :
24
+ -
25
+ identifier : is_in_currency
26
+ expressionValues :
27
+ currency_code : EUR
28
+ -
29
+ identifier : is_product_in_array
30
+ expressionValues :
31
+ product_codes :
32
+ - product_code_book_0
33
+ - product_code_book_1
34
+ -
35
+ identifier : is_product_in_quantity_in_cart
36
+ expressionValues :
37
+ quantity : 2
Original file line number Diff line number Diff line change
1
+ - type : discount
2
+ mode : update
3
+ match :
4
+ field : identifier
5
+ value : summer_sale_2025
6
+ identifier : summer_sale_2025_updated
7
+ translations :
8
+ eng-GB :
9
+ language_code : eng-GB
10
+ name : Updated name
11
+ description : Updated description
12
+ label : Updated promotion label
13
+ label_description : Updated promotion description
14
+ priority : 5
15
+ active : true
16
+ user : admin
17
+ startDate : ' 2024-01-01T00:00:00+00:00'
18
+ endDate : null
19
+ createdAt : null
20
+ updatedAt : null
21
+ rule :
22
+ type : percentage
23
+ expressionValues :
24
+ discount_percentage : ' 10'
25
+ conditions :
26
+ -
27
+ identifier : is_product_in_quantity_in_cart
28
+ expressionValues :
29
+ quantity : 2
Original file line number Diff line number Diff line change @@ -507,6 +507,21 @@ When updating a content type, use:
507
507
[[= include_file('code_samples/data_migration/examples/ai/action_configuration_delete.yaml') =]]
508
508
` ` `
509
509
510
+ # ## Discounts [[% include 'snippets/lts-update_badge.md' %]]
511
+
512
+ - The following example shows how you can create a new [discount](discounts_guide.md) in your system :
513
+
514
+ ` ` ` yaml
515
+ [[= include_file('code_samples/data_migration/examples/discounts/discount_create.yaml') =]]
516
+ ` ` `
517
+
518
+ - Use the `update` mode to modify an existing discount as in the example below.
519
+ The provided conditions overwrite any already existing ones.
520
+
521
+ ` ` ` yaml
522
+ [[= include_file('code_samples/data_migration/examples/discounts/discount_update.yaml') =]]
523
+ ` ` `
524
+
510
525
# # Criteria
511
526
512
527
When using `update` or `delete` modes, you can use criteria to identify the objects to operate on.
You can’t perform that action at this time.
0 commit comments