GraphQL API internal error on remove line item

Shopify Partner
2 0 3


The error occurs when I perform an action on a checkout (which has at least one discountApplication) that leads to an empty checkout. This could be deleting the last lineItem, or updating its quantity to 0.


I use js-buy-sdk. Steps to reproduce:

1. Create a Checkout,

2. Add line items,

3. Assign discount code,

4. Try to remove all line items.




        "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: 075ad8a1-f631-45be-8ed0-ac99080b4b50 (include this in support requests).",
        "extensions": {
            "code": "INTERNAL_SERVER_ERROR",
            "requestId": "075ad8a1-f631-45be-8ed0-ac99080b4b50"


Replies 4 (4)

Shopify Staff
129 15 24

Hey @SzymonSage - thanks for getting in touch. This error can often occur when you're using the checkoutLineItemsRemove mutation without first running the checkoutDiscountRemove mutation. Essentially, what's causing the error is that the checkout still considers the discount as applied, even if items are removed. 

Any discounts applied to a checkout should be removed first before the line items are. This should be possible to serialize into a GraphQL call - hope this helps! I'm going to make a note to see if we can make this more clear in our documentation, but this is expected behaviour of the checkout object. 

Let us know if we can clarify anything further. 

Alan | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit or the Shopify Web Design and Development Blog

Shopify Partner
2 0 3

Thanks for the reply @Alan !


It seems that the expected behavior would be that the API automatically removes discounts, and allows you to remove the item. This is what happens when a checkout no longer meets the requirements of a discount (e.g., when a discount requires 3 items in a checkout, and we remove one - the discount will be removed automatically).

Shopify Partner
4 0 0

We are experiencing the same issue... and similar error message is returned when a discount is applied and we try to remove item from the cart.
it is counter-intuitive, and unexpected how the API responds

it would be also good to have the error wrapped in the mutation error as defined in the documentation. BTW please add this to the documentation to avoid so much confusion 🙏

Not applicable

Great! I had the same issue. But using checkoutLineItemsRemove mutation with first running the checkoutDiscountRemove mutation, It work's well. thx