![]()
Topic summary
Developers reported that Shopify’s Cart API was unexpectedly changing line item keys when adding, updating, or deleting multiple products in a single request. The key would change after the second request but remain stable afterward, breaking functionality like item removal and quantity updates.
Core Issue:
- Line item keys changed inconsistently during cart operations
- Affected
/cart/add.js,/cart/update.js, and/cart/change.jsendpoints - Caused “no valid id or line parameter” errors when attempting to remove items
- Page refresh would correct the keys, suggesting a server-side synchronization problem
Impact:
- Remove links generated by
{{item.url_to_remove}}failed until page refresh - Cart drawer/side cart implementations showed duplicate line items instead of merged quantities
- Discount application/removal also triggered key changes
Resolution:
Shopify Support confirmed and fixed the bug after being contacted through their partner support channel. Multiple users verified the fix is working.
Additional Finding:
One developer discovered that passing boolean values as strings in line item properties can still cause key mismatches, as Shopify converts them to actual booleans server-side, creating temporary hash differences until the page refreshes.
3 Likes