# scAction

Source: https://support.storeconnect.com/articles/pos-sc-action · Last modified 21 August 2026

`scAction` is a global JavaScript function available in the POS. It lets custom code in POS views (Liquid templates rendered in the POS) and inline HTML trigger any POS action programmatically.

## Signature

```javascript

scAction(action, params, options)
```

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `action` | String | Yes | The action identifier (e.g. `'cart:add_product'`) |
| `params` | Object | No | Key-value pairs of action parameters |
| `options` | Object | No | Optional callbacks: `{ onSuccess, onError }` |

### Options

| Option | Type | Description |
|--------|------|-------------|
| `onSuccess` | Function | Called after the action and any chained actions complete successfully. |
| `onError` | Function | Called with an `Error` if any link in the chain rejects — including a missing chained action. Also called synchronously when no `action` is provided. |

## Usage

### Adding a product to the cart

```javascript

scAction('cart:add_product', { product_code: 'SKU123', quantity: 2 })
```

### Starting checkout

```javascript

scAction('checkout:start')
```

### Opening a modal

```javascript

scAction('modal:open:url', { url: '/custom/page' })
```

### In a Liquid/HTML POS view


```html

<button type="button" onclick="scAction('cart:add_product', { product_id: '{{ product.sfid }}' })">
  Add to cart
</button>

<button type="button" onclick="scAction('modal:close')">
  Close
</button>
```


### Reacting to success or failure

Pass `onSuccess` and/or `onError` to handle the outcome of the action:

```javascript

scAction(
  'cart:add_product',
  { product_code: 'SKU123', quantity: 1 },
  {
    onSuccess: () => console.log('Added to cart'),
    onError: (error) => console.error('Failed to add:', error),
  }
)
```

If `onError` is not provided, chain errors are still logged to the browser console via `console.error`.

## Notes

- Callbacks use callback-style (not Promise) to avoid issues with React's Suspense boundary during action dispatch.
- Action identifiers must use `snake_case` from v21. Dash-case identifiers still work but are deprecated.

## Related

- [POS actions reference](pos-actions-reference) — list of available action identifiers
- [checkout:start](pos-checkout-start-action) — start checkout programmatically
- [sync:full](pos-sync-full-action) — force a full POS data sync

---

## Follow StoreConnect

- [Email Newsletter](https://getstoreconnect.com/c/lp-newsletter)
- [LinkedIn Newsletter](https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7444956928444862464)
- [YouTube](https://www.youtube.com/channel/UCngKdP2x8l1wcbAKW3tvU8g)
- [LinkedIn](https://www.linkedin.com/company/storeconnect)
- [X / Twitter](https://x.com/storeconnecthq)

## Popular Links

- [Partners](https://getstoreconnect.com/partners)
- [News](https://getstoreconnect.com/articles/news)
- [Events](https://getstoreconnect.com/articles/events)
- [Feature Comparison](https://getstoreconnect.com/how-we-compare)
- [Download a free trial](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMkeKUAT)
- [Book a Demo](https://getstoreconnect.com/contact)

## Documentation

- [Help documentation](https://support.storeconnect.com/help-documentation)
- [AI agents](https://support.storeconnect.com/ai)
- [Videos & tutorials](https://support.storeconnect.com/videos-tutorials)
- [Developer reference](https://support.storeconnect.com/developer-reference)
- [Release notes](https://support.storeconnect.com/release-notes)
- [Troubleshooting](https://support.storeconnect.com/troubleshooting)
- [Trust Center](https://trust.getstoreconnect.com/)
- [Status Page](https://status.storeconnect.com/)

## Contact

- info@getstoreconnect.com
- US +1 415 745 3230
- AUS +61 2 8365 2308

100 S Ashley Dr, Suite 600-2461
Tampa FL 33602-600 USA

Level 22, Sydney Place
180 George Street
Sydney, NSW, 2000, AUS

---

StoreConnect Support — https://support.storeconnect.com/articles/pos-sc-action