I cannot remove a line that has a discount code applied using the mutation subscriptionDraftLineRemove.
I get the error below when I call subscriptionDraftCommit. (after calling subscriptionDraftLineRemove)
Contract draft discount with title: “my discount code” is invalid
Can this be an issue on the Shopify side? Or should I do something else to remove a subscription line with a discount code applied?
1 Like
Did you ever find the solution to this? I’m getting the same error.
If there’s an existing discount targeting a line in your subscription, and that line gets removed you will get the error because the discount no longer points at a valid target.
Have you tried updating the discount by changing the entitledLines? (`
SubscriptionManualDiscountLinesInput.remove`)
https://shopify.dev/api/admin-graphql/2022-01/mutations/subscriptionDraftDiscountUpdate#returns
@Philibert_Dugas Thanks for the tip in the right direction. What we ended up doing is if the attempt to amend the draft line returned that error, we used subscriptionDraftDiscountRemove to remove the specific discount applied before attempting to edit the line again. It’s a little clunky and requires quite a few API calls but it works.
2 Likes