labd/terraform-provider-commercetools

Request for support for cart discount target

hchan01 opened this issue · 2 comments

Hello team. I am trying to add the following cart discount with target type "totalPrice":

resource "commercetools_cart_discount" "discount" {
name = {
en = "Discount"
}
description = {
en = "Discount"
}
value {
type = "relative"
permyriad = 10000
}
predicate = "custom.orderHeaderKey is defined"
target {
type = "totalPrice"
}
sort_order = "0.5"
}

I get this error when deploying:

Error: "totalPrice" not a valid value for "target.0.type"

I'm not sure if it is a recent addition but according to the CommerceTools docs https://docs.commercetools.com/api/projects/cartDiscounts#cartdiscounttarget, cart totalPrice is a supported target. I also tried manually creating this cart discount in the CommerceTools UI then queried for it, and the target is returned as:

"target": {
"type": "totalPrice"
},

Thanks in advance

Hi @hchan01

We are indeed missing the totalPrice as a target in the code. This should not be a difficult change, I will look into it

Awesome, thanks @demeyerthom for the quick response!