Skip to content

Discount migrations #2768

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
- type: discount
mode: create
identifier: summer_sale_2025
translations:
-
language_code: eng-GB
name: "Summer Sale 2025"
description: "-10% on laptops"
label: "HOT DEAL: Summer Sale!"
label_description: "Get 10% off on selected items!"
discount_type: cart
priority: 8
enabled: true
user: admin
startDate: '2024-01-01T00:01:00+00:00'
endDate: null
createdAt: null
updatedAt: null
rule:
type: percentage
expressionValues:
discount_percentage: 10
conditions:
-
identifier: is_in_currency
expressionValues:
currency_code: EUR
-
identifier: is_product_in_array
expressionValues:
product_codes:
- product_code_book_0
- product_code_book_1
-
identifier: is_product_in_quantity_in_cart
expressionValues:
quantity: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- type: discount
mode: update
match:
field: identifier
value: summer_sale_2025
identifier: summer_sale_2025_updated
translations:
eng-GB:
language_code: eng-GB
name: Updated name
description: Updated description
label: Updated promotion label
label_description: Updated promotion description
priority: 5
active: true
user: admin
startDate: '2024-01-01T00:00:00+00:00'
endDate: null
createdAt: null
updatedAt: null
rule:
type: percentage
expressionValues:
discount_percentage: '10'
conditions:
-
identifier: is_product_in_quantity_in_cart
expressionValues:
quantity: 2
15 changes: 15 additions & 0 deletions docs/content_management/data_migration/importing_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,21 @@ When updating a content type, use:
[[= include_file('code_samples/data_migration/examples/ai/action_configuration_delete.yaml') =]]
```

### Discounts [[% include 'snippets/lts-update_badge.md' %]]

- The following example shows how you can create a new [discount](discounts_guide.md) in your system:

``` yaml
[[= include_file('code_samples/data_migration/examples/discounts/discount_create.yaml') =]]
```

- Use the `update` mode to modify an existing discount as in the example below.
The provided conditions overwrite any already existing ones.

``` yaml
[[= include_file('code_samples/data_migration/examples/discounts/discount_update.yaml') =]]
```

## Criteria

When using `update` or `delete` modes, you can use criteria to identify the objects to operate on.
Expand Down
Loading