- Your script should work like this. First remove products from the list, and then recalculate in cart.js.
- There is no documentation. Each cart has its own documentation, but I don’t think you will find anything about it there.
It would be better for you to attach a link to your store.
Topic summary
Issue: Quantity limits are enforced via a script using Shopify AJAX (/cart/change.js). cart.js reflects the reset quantity, but the checkout shows the old quantity unless the page is refreshed. A page reload fixes it, which the team wants to avoid.
Proposed approach: Trigger a cart update after changing quantities to run the theme’s cart “recalculation” logic.
- Use a fetch call to /cart/update.json to update the cart state after /cart/change.js.
- Ensure the script does not block the theme’s cart update/recalculation code.
Explanation: Resetting item quantities without triggering the cart update flow means the theme’s fetch/recalculation isn’t executed, causing mismatch between cart.js and checkout. Test by programmatically changing the cart; if the cart reloads, the custom script is likely blocking the main cart script.
Details: Using change.js vs update.js may not inherently differ; the key is to recalculate/update the cart after quantity changes. First remove products, then recalculate in cart.js.
Documentation: No official Shopify docs were provided for /cart/update.json.
Status: Ongoing. Action items are to implement a cart update call and verify no script blocks the cart recalculation. Unanswered: official documentation and exact implementation guidance.