|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "commercetools_product_discount Resource - terraform-provider-commercetools" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + Product discounts are used to reduce certain product prices. |
| 7 | + Also see the Product Discount API Documentation https://docs.commercetools.com/api/projects/productDiscounts. |
| 8 | +--- |
| 9 | + |
| 10 | +# commercetools_product_discount (Resource) |
| 11 | + |
| 12 | +Product discounts are used to reduce certain product prices. |
| 13 | + |
| 14 | +Also see the [Product Discount API Documentation](https://docs.commercetools.com/api/projects/productDiscounts). |
| 15 | + |
| 16 | +## Example Usage |
| 17 | + |
| 18 | +```terraform |
| 19 | +resource "commercetools_product_discount" "my-product-discount" { |
| 20 | + key = "my-product-discount-key" |
| 21 | + name = { |
| 22 | + en = "Product discount name" |
| 23 | + } |
| 24 | + description = { |
| 25 | + en = "Product discount description" |
| 26 | + } |
| 27 | + predicate = "1=1" |
| 28 | + sort_order = "0.9" |
| 29 | + is_active = true |
| 30 | + valid_from = "2018-01-02T15:04:05Z" |
| 31 | + valid_until = "2019-01-02T15:04:05Z" |
| 32 | +
|
| 33 | + value { |
| 34 | + type = "relative" |
| 35 | + permyriad = 1000 |
| 36 | + } |
| 37 | +} |
| 38 | +
|
| 39 | +resource "commercetools_product_discount" "my-product-discount-absolute" { |
| 40 | + key = "my-product-discount-absolute-key" |
| 41 | + name = { |
| 42 | + en = "Product discount name" |
| 43 | + } |
| 44 | + description = { |
| 45 | + en = "Product discount description" |
| 46 | + } |
| 47 | + predicate = "1=1" |
| 48 | + sort_order = "0.9" |
| 49 | + is_active = true |
| 50 | + valid_from = "2018-01-02T15:04:05Z" |
| 51 | + valid_until = "2019-01-02T15:04:05Z" |
| 52 | +
|
| 53 | + value { |
| 54 | + type = "absolute" |
| 55 | + money { |
| 56 | + currency_code = "EUR" |
| 57 | + cent_amount = 500 |
| 58 | + } |
| 59 | + } |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +<!-- schema generated by tfplugindocs --> |
| 64 | +## Schema |
| 65 | + |
| 66 | +### Required |
| 67 | + |
| 68 | +- `name` (Map of String) [LocalizedString](https://docs.commercetools.com/api/types#localizedstring) |
| 69 | +- `predicate` (String) A valid [Product Predicate](https://docs.commercetools.com/api/projects/predicates#product-predicates) |
| 70 | +- `sort_order` (String) The string must contain a number between 0 and 1. All matching product discounts are applied to a product in the order defined by this field. A discount with greater sort order is prioritized higher than a discount with lower sort order. The sort order is unambiguous among all product discounts |
| 71 | +- `value` (Block List, Min: 1, Max: 1) Defines the effect the discount will have. [ProductDiscountValue](https://docs.commercetools.com/api/projects/productDiscounts#productdiscountvalue) (see [below for nested schema](#nestedblock--value)) |
| 72 | + |
| 73 | +### Optional |
| 74 | + |
| 75 | +- `description` (Map of String) [LocalizedString](https://docs.commercetools.com/api/types#localizedstring) |
| 76 | +- `is_active` (Boolean) When set the product discount is applied to products matching the predicate |
| 77 | +- `key` (String) User-defined unique identifier for the ProductDiscount. Must be unique across a project |
| 78 | +- `valid_from` (String) |
| 79 | +- `valid_until` (String) |
| 80 | + |
| 81 | +### Read-Only |
| 82 | + |
| 83 | +- `id` (String) The ID of this resource. |
| 84 | +- `version` (Number) |
| 85 | + |
| 86 | +<a id="nestedblock--value"></a> |
| 87 | +### Nested Schema for `value` |
| 88 | + |
| 89 | +Required: |
| 90 | + |
| 91 | +- `type` (String) Currently supports absolute/relative/external |
| 92 | + |
| 93 | +Optional: |
| 94 | + |
| 95 | +- `money` (Block List) Absolute discount specific fields (see [below for nested schema](#nestedblock--value--money)) |
| 96 | +- `permyriad` (Number) Relative discount specific fields |
| 97 | + |
| 98 | +<a id="nestedblock--value--money"></a> |
| 99 | +### Nested Schema for `value.money` |
| 100 | + |
| 101 | +Required: |
| 102 | + |
| 103 | +- `cent_amount` (Number) The amount in cents (the smallest indivisible unit of the currency) |
| 104 | +- `currency_code` (String) The currency code compliant to [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) |
| 105 | + |
| 106 | +Optional: |
| 107 | + |
| 108 | +- `fraction_digits` (Number) The number of default fraction digits for the given currency, like 2 for EUR or 0 for JPY |
| 109 | + |
| 110 | + |
0 commit comments