I want to create a discount that applies only to a specific LineItem, but OrderLineItem does not have a field to represent this.
Hi Shota,
Have you tried using the orderEditAddLineItemDiscount
mutation? It allows you to specify a lineItemId and a discount. It would look something like this:
mutation AddLineItemDiscount {
orderEditAddLineItemDiscount(
discount: {
description: "10% off specific item",
percentValue: 10.0
},
id: "gid://shopify/OrderEdit/1234567890",
lineItemId: "gid://shopify/LineItem/0987654321"
) {
addedDiscountStagedChange {
description
id
value {
... on PricingPercentageValue {
percentage
}
}
}
calculatedLineItem {
id
title
discountedUnitPriceSet {
presentmentMoney {
amount
currencyCode
}
}
}
userErrors {
field
message
}
}
}
1 Like
@Liam-Shopify
Hi Liam,
I didn’t know that. Thanks for telling me! But I hope it will be possible to achieve this with just orderCreate.