POS cart: add optional options arg to addLineItem#4531
Draft
vctrchu wants to merge 1 commit into
Draft
Conversation
Contributor
Author
|
/snapit |
Add an optional third argument to cart.addLineItem so a single call can
create a line item and decorate it with line-item properties and
cart-level properties, instead of chaining addLineItem ->
addLineItemProperties -> addCartProperties.
Introduces the AddLineItemOptions type ({properties?, cartProperties?}).
Backwards compatible: the third argument is optional. Follows the
TAG-friendly options-bag pattern (extend existing method over new method).
Assisted-By: devx/c896ba3a-e6c5-4ba0-ab6b-a5192c47d56a
Contributor
|
🫰✨ Thanks @vctrchu! Your snapshots have been published to npm. Test the snapshots by updating your "@shopify/ui-extensions": "0.0.0-snapshot-20260626012557",
"@shopify/ui-extensions-tester": "0.0.0-snapshot-20260626012557" |
f0e902b to
e409ce4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add an optional third argument to the POS
cart.addLineItemmethod so a single call can create a line item and decorate it with line-item properties and cart-level properties:Introduces the
AddLineItemOptionstype. Backwards compatible — the third argument is optional, so existing two-argument calls are unchanged.Why
Cafe-style POS extensions adding a "modified item" (e.g. coffee + modifiers + order metadata) currently chain three extension API calls:
Each call awaits its own native SDK call and
syncDraftCheckoutround-trip — measured at ~3s p50 for the sequential pattern.