Cannot subscriptionDraftLineRemove on lines with discount code applied

Kazs
Explorer
53 1 10

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?

 

 

Replies 3 (3)
Conjured_Char
Shopify Partner
33 0 3

Did you ever find the solution to this? I'm getting the same error.

Philibert_Dugas
Shopify Staff
Shopify Staff
25 11 8

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? (`

Conjured_Char
Shopify Partner
33 0 3

@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.