Skip to content

feat(pos): add optional lineItems arg to addLineItem#4531

Open
vctrchu wants to merge 1 commit into
2026-07-rcfrom
pos-cart-add-line-item-options
Open

feat(pos): add optional lineItems arg to addLineItem#4531
vctrchu wants to merge 1 commit into
2026-07-rcfrom
pos-cart-add-line-item-options

Conversation

@vctrchu

@vctrchu vctrchu commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Part of https://github.com/shop/issues-retail/issues/28967
Dev Forum Request

What

Add an optional third argument to the POS cart.addLineItem method so a single call can create a line item and decorate it with line-item properties:

cart.addLineItem(variantId, quantity, options?: {
  properties?: Record<string, string>; // line-item properties
});

Introduces the AddLineItemOptions type. 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) currently chain two extension API calls:

const uuid = await cart.addLineItem(variantId, 1);
await cart.addLineItemProperties(uuid, {modifiers: 'oat milk,extra shot'});

Each call awaits its own native SDK call and syncDraftCheckout round-trip — measured at ~3s p50 for the sequential pattern.

@vctrchu

vctrchu commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

/snapit

@shopify-github-actions-access

Copy link
Copy Markdown
Contributor

🫰✨ Thanks @vctrchu! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/ui-extensions": "0.0.0-snapshot-20260626012557",
"@shopify/ui-extensions-tester": "0.0.0-snapshot-20260626012557"

@vctrchu vctrchu force-pushed the pos-cart-add-line-item-options branch from f0e902b to e409ce4 Compare June 26, 2026 01:27
Add an optional third argument to cart.addLineItem so a single call can
create a line item and decorate it with line-item properties, instead of
chaining addLineItem -> addLineItemProperties.

Introduces the AddLineItemOptions type ({properties?}). Backwards
compatible: the third argument is optional. Follows the TAG-friendly
options-bag pattern (extend existing method over new method).

Assisted-By: devx/2ccb68c4-3a6f-43e0-9eb1-37bda8685c84
@vctrchu vctrchu force-pushed the pos-cart-add-line-item-options branch from e409ce4 to b38d150 Compare June 26, 2026 21:31
@vctrchu

vctrchu commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

/snapit

@shopify-github-actions-access

Copy link
Copy Markdown
Contributor

🫰✨ Thanks @vctrchu! Your snapshots have been published to npm.

Test the snapshots by updating your package.json with the newly published versions:

"@shopify/ui-extensions": "0.0.0-snapshot-20260626213319",
"@shopify/ui-extensions-tester": "0.0.0-snapshot-20260626213319"

@vctrchu vctrchu self-assigned this Jun 26, 2026
@vctrchu vctrchu marked this pull request as ready for review June 26, 2026 22:28
@vctrchu vctrchu requested a review from a team June 26, 2026 22:29
@vctrchu vctrchu changed the title POS cart: add optional options arg to addLineItem feat(pos): add optional lineItems arg to addLineItem Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant