Skip to main content
The Cart Operations extension lets you inspect the current cart and return native cart mutations.

Exported function

Export onCartChanged from the extension module:
Use CartOperations to create the returned mutations. See Cart operations and Data models.

Execution behavior

  • Native can invoke the hook repeatedly, up to three passes.
  • Each pass receives the latest cart after previously returned operations are applied.
  • Conflicting operations are suppressed by the native runner.
  • Return an empty array when no change is needed.
  • Async work must complete within the extension’s three-second execution budget.
Keep the hook idempotent. Repeated passes should converge instead of continuously producing new operations.