Hey @Ian_Bale and @Victor_Chu,
Ian, thank you for your reply and the suggestion about handing the cart mutation off to the Tile. I think that is a really good workaround for improving perceived performance, especially when the delay is only a couple of seconds.
In our case, though, we have had a large number of merchants report that the addLineItem process can take up to 10-15 seconds. In those situations, even handing the work off to the Tile could still cause issues, because the cart mutation is still running for a long time in the background and we need to manage pending state, duplicate taps, failures, and cart reconciliation.
We have tried to find a common thread among those affected merchants, and so far it seems to be either older iPad hardware, weaker internet/Wi-Fi, or both. That makes me think there is an underlying issue with the current addLineItem flow, especially because extension developers have to wait for the POS-issued UUID before we can safely attach required line item properties.
For configured-product workflows, the current flow can require several separate cart mutations:
- Add the base product line with
addLineItem. - Shopify POS creates, validates, prices, and materializes that line before returning the POS-issued UUID.
- Use that UUID to attach the line item properties that describe the configured item, creating another cart update.
- Add/update cart properties, creating another cart update.
- Optionally apply discounts, creating another cart update.
In our app, we also use Cart Transform. The Cart Transform logic depends on the line item properties added after addLineItem, so the meaningful transform work likely happens after the property mutation rather than during the initial bare line insert.
That means the current API flow can create an intermediate cart state where the product line exists, but the metadata required to interpret it has not been attached yet. If Cart Transform functions, subscribers, or other cart update processing run after each mutation, a single configured item can cause multiple rounds of cart processing before the final cart state is ready.
When step 1 takes several seconds, everything else is blocked behind it.
@Ian_Bale - I also really like your transaction suggestion. I think that would be the ideal API shape, rather than Shopify simply adding a convenience wrapper that internally performs multiple cart mutations. Something like:
const transaction = await shopify.cart.startTransaction();
transaction.addLineItem({
variantId,
quantity,
properties: lineProperties,
});
transaction.addCartProperties(cartProperties);
await transaction.commit();
The important part would be that Shopify POS applies all changes as one atomic cart operation and emits one final cart update event, rather than exposing intermediate states or firing multiple cart updates/functions/subscribers.
That would help with a few things:
- Avoid waiting for a UUID before attaching required properties.
- Reduce partial cart states.
- Avoid multiple cart update events for a single configured item.
- Reduce cart transform / subscriber churn.
- Improve reliability on older devices or weaker networks.
- Give extension developers a safer way to create fully configured cart lines.
So I think there are two related asks here:
- Improve the baseline performance of
shopify.cart.addLineItem(...), especially on older iPads or slower networks. - Consider a transaction/batched cart API so extensions can create a configured cart line with properties and cart attributes in one atomic operation.
Happy to provide timing logs or reproduction details if useful.
Thank you so much,
Adam