Could not apply line item changes when we use applyCartLines

harshad07
Shopify Partner
3 0 0

When performing actions such as adding or removing items in the cart using the applyCartLines function,

it often results in an error message stating "Could not apply line item changes."

 

The function only works reliably if it is triggered once. However, in scenarios where you need to dynamically adjust the cart based on factors such as province ID, you may encounter issues.

 

For example, when adding items based on one province ID and then needing to remove old items and add new variants based on a different province ID, the first API call may succeed while the subsequent one fails.

 

This issue has been reported on GitHub (https://github.com/Shopify/ui-extensions/issues/1436), but unfortunately, there are no solutions provided at the moment.

Replies 2 (2)

Liam
Shopify Staff
2731 299 769

Hi Harshad07 - thanks for flagging this, I think your best bet here would be to follow along with that github issue - when a fix is applied that issue will be updated/ closed.

Liam | Developer Advocate @ 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 Shopify.dev or the Shopify Web Design and Development Blog

harshad07
Shopify Partner
3 0 0

Thank you for your prompt response.

I understand your suggestion to follow along with the GitHub issue.
However, I'd like to emphasize that the issue has been open for quite some time now, since October 12, 2023, without any significant progress or viable solutions proposed. This ongoing problem with the applyCartLines function has been causing inconvenience in our workflow, especially when dynamically adjusting the cart based on different province IDs.

Given the lack of resolution on the GitHub issue, I was hoping we could explore alternative avenues to address this issue more effectively. Perhaps escalating it within your team or seeking direct support from Shopify's technical experts could help expedite the resolution process.

Looking forward to your further guidance and support.